In short, I'm trying to pass some Excel ActiveWindow VBA properties, but can't seem to get it right.
If you're not familiar, his code asks for you to fill an array with information and then call a function called copyObjectsToExcelSheet(). The function looks like this:
Set objExcelApp = CreateObject("Excel.Application")
Set objExcelDoc = objExcelApp.Workbooks.Add
'a bunch of stuff with the array
Set copyObjectsToExcelSheet = objExcelDoc
end function
After the function ends, you're sent back to the original sub, which ends this way:
Dim objExcelWorkbook 'as Excel.Workbook
Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)
'// Now either just leave Excel open or do some other stuff here
'// like saving the excel, some formatting stuff, ...
As you can see, the author encourages you to make any changes at this point, by adding to the code.
After the code runs, I can make changes to the Sheet objects by adding some things. Like this:
For i = 1 to 4
With objExcelWorkbook.Sheets(i).Range("A1:A2").Font