Reputation: 985
Is it possible to store a PageSetup object that will be used to set the printing options of a worksheet? I tried with this code but I'm getting an error that says: Object variable or With block variable not set. This is how I'm doing it since I need to setup the settings first from a form and loop through some sheets using the printing settings stored in this object.
Dim curPageSetup As PageSetup
curPageSetup.paperSize = xlPaperA3
Upvotes: 0
Views: 396
Reputation: 3263
If all that you want to do is change the PaperSize
for all of the sheets in your book, you can do it like this
Sub SetPaperSize()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.PageSetup.PaperSize = xlPaperA3
Next ws
End Sub
Not necessary to store PageSetup
to change its attributes
Upvotes: 1