PDA

View Full Version : Solved: Pagesetup.PaperSize



shaggles
03-04-2009, 04:31 PM
I'm having a problem setting the papersize for my file. From the macro recorder I got .papersize = xlpaperlegal but that doesn't work in my code (I'm exporting from Access and all the code is in an Access module.) I had a similar problem with .orientation = xllandscape but I found that changing xllandscape to 2 worked. Is there a numeric code (or something elxe) that I should use instead of xlpaperlegal? Here's my code:

With xlw.worksheets(1).pagesetup
.printgridlines = True
.Orientation = 2
.Papersize = xlpaperlegal
End With

mdmackillop
03-04-2009, 04:42 PM
xlpaperlegal = 5

You can get these in the Object Browser

shaggles
03-04-2009, 05:12 PM
That did it. Thanks.