Good morning,
VBA rookie here. Hoping someone can help me with my issue.
I am trying to create a button to have each sheet be listed in the print preview using a button. Each sheet is hidden so it won't let me print preview. I tried to make the workbooks visible then re-hide them upon completion. It is able to proceed with the print preview as I would like, but it errors out when it gets to "ws.Visible = False". The error reads "Run-time error'438': Object doesn't support this property or method. "
See code below...
I may need some type of except command to exclude the "print menu" from being hidden and leaving a workbook with no visible sheets.
Appreciate the help!
VBA rookie here. Hoping someone can help me with my issue.
I am trying to create a button to have each sheet be listed in the print preview using a button. Each sheet is hidden so it won't let me print preview. I tried to make the workbooks visible then re-hide them upon completion. It is able to proceed with the print preview as I would like, but it errors out when it gets to "ws.Visible = False". The error reads "Run-time error'438': Object doesn't support this property or method. "
See code below...
VBA Code:
'unhide sheets
For Each ws In ThisWorkbook.Worksheets
ws.Visible = True
Next ws
'Printpreview Array
Sheets(SheetArray()).PrintPreview
Sheets("Print Menu").Activate
're-hide each sheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = False
Next ws
I may need some type of except command to exclude the "print menu" from being hidden and leaving a workbook with no visible sheets.
Appreciate the help!
Last edited by a moderator: