With appExcel.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End WithWith appExcel.Selection
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
End WithSave and close the filled-in worksheet, using a workbook save name with the date range:strSheetName = “Northwind Orders as of “ _
& Format(Date, “d-mmm-yyyy”)
Debug.Print “Sheet name: “ & strSheetNameWrite the title with the date range to the worksheet:wks.Range(“A1”).Value = strSheetName
strSaveName = strDBPath & strSheetName & “.xlsx”
Debug.Print “Time sheet save name: “ & strSaveNameChDir strDBPathOn Error Resume NextIf there already is a saved worksheet with this name, delete it:Kill strSaveNameOn Error GoTo ErrorHandler
wkb.SaveAs FileName:=strSaveName, _
FileFormat:=xlWorkbookDefault
wkb.Close
rst.ClosePut up a success message with the name and path of the new worksheet:strTitle = “Workbook created”
strPrompt = strSheetName & vbCrLf & “created in “ _
& strDBPath
MsgBox strPrompt, vbOKOnly + vbInformation, strTitleErrorHandlerExit:
Exit SubErrorHandler:
‘Excel is not running; open Excel with CreateObjectPart I The Office Components and What They Do Best