我有下面的代碼,我在這里問我需要在代碼中添加什么才能僅列印第 1 到 3 頁?
Sub PrintVisa()
Dim invoiceRng As Range
Dim pdfile As String
'Setting range to be printed
Set invoiceRng = Range("C7:L175")
pdfile = " Seabourn_Visa_Letter"
invoiceRng.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=pdfile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=True, _
OpenAfterPublish:=True
uj5u.com熱心網友回復:
請嘗試下一個代碼:
Sub ExportFirstThreeSheets()
Dim FileName As String
FileName = ThisWorkbook.Path & "\MyThreeSheets.pdf"
Sheets(Array(1, 2, 3)).copy 'it creates a new workbook containing the first three sheets
With ActiveWorkbook
.ExportAsFixedFormat xlTypePDF, FileName, , , , , , True
.Close False
End With
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/377345.html
