[英]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.