[英]How can I make PDF with Landscape orientation from an Excel file in Vba Access?
我曾经使用以下代码从 Access 表单制作 pdf 文件:
DoCmd.OutputTo acOutputForm,"FR_PFMEAPrint2", acFormatPDF,"PFMEAPrint2.PDF", True
我使用以下代码在 Access 中以纵向打印 Excelforms:
Excel_App.ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
对于风景,我在 Access 中使用了此代码:
Forms("FR_Print").Printer.Orientation = acPRORLandscape
DoCmd.PrintOut acPages, 1, 1, , 1
但我需要通过 Vba Access 将 Excel 文件输出为 PDF 横向格式谢谢
您必须设置 Excel Sheet
对象的属性,如下面的示例代码片段所示:
Sheets(1).PageSetup.Orientation = xlLandscape
与您的情况相关,它将如下所示:
Excel_App.ActiveWindow.SelectedSheets(1).PageSetup.Orientation = xlLandscape
或者您可以遍历多个工作Sheets
并在循环中设置它们的属性。 另外,仅供参考:您可以使用基础xlLandscape
值 2。
希望这会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.