G
Guest
I am getting an error: "xlApp.Range("A5", Cells(lastrow...= <Object variable
or With block variable not set>" on this line:
xlApp.ActiveSheet.PageSetup.PrintArea = xlApp.Range("A5", Cells(lastrow,
intColNo)).Address
in the following block of code, which is trying to set the print area of a
worksheet:
intColNo = 5 + ((rsPGrpDetail.Fields.Count) - 7)
Dim lastrow
With xlApp.ActiveSheet
lastrow = .Range("A65536").End(xlUp).Row
End With
''macro4 page setup
With xlApp.ActiveSheet.PageSetup
.PrintTitleRows = "$1:$4"
.PrintTitleColumns = ""
End With
xlApp.ActiveSheet.PageSetup.PrintArea = xlApp.Range("A5",
Cells(lastrow, intColNo)).Address
**** there is more, but this is the snipet of the block im havin problems
with. I dont understand what is missing. "xlApp" represents the excel
application object.
***any help is greatly appreciated
or With block variable not set>" on this line:
xlApp.ActiveSheet.PageSetup.PrintArea = xlApp.Range("A5", Cells(lastrow,
intColNo)).Address
in the following block of code, which is trying to set the print area of a
worksheet:
intColNo = 5 + ((rsPGrpDetail.Fields.Count) - 7)
Dim lastrow
With xlApp.ActiveSheet
lastrow = .Range("A65536").End(xlUp).Row
End With
''macro4 page setup
With xlApp.ActiveSheet.PageSetup
.PrintTitleRows = "$1:$4"
.PrintTitleColumns = ""
End With
xlApp.ActiveSheet.PageSetup.PrintArea = xlApp.Range("A5",
Cells(lastrow, intColNo)).Address
**** there is more, but this is the snipet of the block im havin problems
with. I dont understand what is missing. "xlApp" represents the excel
application object.
***any help is greatly appreciated