Excel到PDF,如何在PDF上设置横向模式

时间:2017-04-21 15:20:05

标签: vbscript

以下代码有效,但我不确定将景观代码放在哪里

Dim objXL
Set objXL = CreateObject("Excel.Application")
objXL.WorkBooks.Open ("C:\Users\MyUSer\Desktop\test1.xlsx") 
objXL.WorkBooks(1).Sheets("by CC").ExportAsFixedFormat 0, "C:\Users\H51516\Desktop\test1.pdf"
objXL.WorkBooks(1).Close False
Set objXL = nothing

1 个答案:

答案 0 :(得分:0)

您可以使用以下内容在导出前设置页面方向:

Dim objXL
Set objXL = CreateObject("Excel.Application")
objXL.WorkBooks.Open ("C:\Users\MyUSer\Desktop\test1.xlsx") 
objXL.WorkBooks(1).Sheets("by CC").PageSetup.Orientation = xlLandscape
objXL.WorkBooks(1).Sheets("by CC").ExportAsFixedFormat 0, "C:\Users\H51516\Desktop\test1.pdf"
objXL.WorkBooks(1).Close False
Set objXL = nothing