Vbscript 如何在vbs中使用页面设置?

Vbscript 如何在vbs中使用页面设置?,vbscript,Vbscript,我试图实现PageSetupclass With objWb.Worksheets("test") .PageSetup.RightMargin=0.5 'executes okay .PageSetup.PaperSize = xlPaperLegal 'throws an error .PageSetup.Orientation = xlLandscape 'throws an error End With 错误:无法设置PageSetup类的Pap

我试图实现
PageSetup
class

With objWb.Worksheets("test")
.PageSetup.RightMargin=0.5              'executes okay
.PageSetup.PaperSize = xlPaperLegal     'throws an error
.PageSetup.Orientation = xlLandscape    'throws an error
End With
错误:
无法设置PageSetup类的PaperSize属性
虽然
.PageSetup.RightMargin=0.5
执行良好。接下来的两行为什么不执行


如何使用
paperLegal
scape

这些都是Excel常量。你需要自己定义它们。在Excel的VBA屏幕中使用对象浏览器(点击ALT+F11进入VBA,然后点击F2打开对象浏览器)


这些是Excel常量。你需要自己定义它们。在Excel的VBA屏幕中使用对象浏览器(点击ALT+F11进入VBA,然后点击F2打开对象浏览器)

Const xlPaperLegal = 5
Const xlLandscape  = 2