Excel VBA打印边距似乎被忽略
我无法为我的打印部分设置保证金。 当我执行marco时,打印预览总是popup默认页边距,而不是我设置的页边距。
'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
我看不出我做错了什么。 有什么build议么?
如何使用:
With .PageSetup
代替
With PageSetup
稍后编辑
嵌套With .PageSetup
将引用外部With
对象(即newSheet
)的PageSetup
属性。 没有点,一个引用可能适用于其他(当前活动)对象的PageSetup属性。
更多关于MSDN的信息: http : //msdn.microsoft.com/en-us/library/wc500chb.aspx (最后一个例子)