Adjust worksheet print setup and margins:.PageSetup.PrintTitleRows = “$5:$5”
.PageSetup.LeftFooter = “&F”
.PageSetup.CenterFooter = “”
.PageSetup.CenterHeader = “”
.PageSetup.RightFooter = “Page &P”
.PageSetup.Orientation = xlLandscape
.PageSetup.PrintGridlines = False
.PageSetup.Zoom = 90
End WithMake worksheet visible and save it:appExcel.Application.Visible = TruestrPrompt = _
“Enter file name and path for saving worksheet”
strTitle = “File name”
strDefault = strSaveName
strSaveName = InputBox(prompt:=strPrompt, _
Title:=strTitle, Default:=strDefault)wkb.SaveAs FileName:=strSaveName, _
FileFormat:=xlWorkbookDefault
appExcel.Visible = TrueErrorHandlerExit:
Exit FunctionErrorHandler:
If Err = 429 ThenExcel is not running; open Excel with CreateObject:Set appExcel = CreateObject(“Excel.Application”)
Resume Next
Else
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End IfEnd FunctionPart II Writing VBA Code to Exchange Data between Office Components