PaulBricker
Programmer
This has to be so simple as to be embarrassing but I'm opening an Excel spreadsheet. The spreadsheet opens to a specific Worksheet. I want to move to another worksheet (there are only two in the spreadsheet). How do I change the ActiveSheet from the one it open on to the other one. I've tried something like this but get Error 9, subscript out of range.
Dim objXL As Excel.Application
Dim objWkb As Excel.Workbook
Dim objSht As Excel.Worksheet
Const conSHT_NAME = "qryZBar"
Const conWKB_NAME = "c:\MyStuff\qryWOCountByMonth.xls"
Set objXL = New Excel.Application
With objXL
.Visible = True
Set objWkb = .Workbooks.Open(conWKB_NAME)
Set objSht = objWkb.Worksheets(conSHT_NAME)
ActiveSheet.PrintOut
I've tried
Worksheets("qryZBar"
.Activate
and all kinds of variations. It there some way to go from the default worksheet to another sheet in the WorkBook.
Thanks
Paul
Dim objXL As Excel.Application
Dim objWkb As Excel.Workbook
Dim objSht As Excel.Worksheet
Const conSHT_NAME = "qryZBar"
Const conWKB_NAME = "c:\MyStuff\qryWOCountByMonth.xls"
Set objXL = New Excel.Application
With objXL
.Visible = True
Set objWkb = .Workbooks.Open(conWKB_NAME)
Set objSht = objWkb.Worksheets(conSHT_NAME)
ActiveSheet.PrintOut
I've tried
Worksheets("qryZBar"
and all kinds of variations. It there some way to go from the default worksheet to another sheet in the WorkBook.
Thanks
Paul