Reputation: 14912
I am not able to set the margin for my print section. When I execute the marco the print preview always pops up with default margins, and not with the margin I have set.
'Setup print stuff, print and delete the worksheet
With newSheet
With PageSetup
.PaperSize = xlPaperA4
.BlackAndWhite = True
.LeftMargin = Application.InchesToPoints(0.2)
End With
'Use PrintPreview for Debugging
.PrintPreview
.Delete
End With
I can't see what I am doing wrong. Any suggestions?
Upvotes: 0
Views: 822
Reputation:
How about using:
With .PageSetup
instead of
With PageSetup
Later edit
The nested With .PageSetup
will refer to the PageSetup
property of the outer With
object (i.e. newSheet
). Without the dot, one refers a PageSetup property that might apply to some other (currently active) object.
More on MSDN: http://msdn.microsoft.com/en-us/library/wc500chb.aspx (the last example)
Upvotes: 2