0
我有一些代碼循環通過數據驗證列表並打印頁面作爲PDF文件,我無法弄清楚如何調整它只發送頁面到打印機,而不是打印作爲PDF。循環通過DV範圍併發送到打印機
Sub Button11_Click()
Application.ScreenUpdating = False
Dim cell As Range
Dim rgDV As Range
Dim DV_Cell As Range
Dim ws As Worksheet
Dim strPath As String
Dim myFile As Variant
Dim strFile As String
Dim LA As Boolean
Dim A As Integer
Dim B As Integer
Set DV_Cell = Range("B1")
Set rgDV = Application.Range(Mid$(DV_Cell.Validation.Formula1, 2))
A = Application.InputBox("Enter Page From")
B = Application.InputBox("Enter Page To")
Set ws = ActiveSheet
For Each cell In rgDV.Cells
DV_Cell.Value = cell.Value
strFile = Cells.Range("B1") & " Period " & Cells.Range("J1")
strFile = Cells(5, 17).Value & "\" & strFile & ".PDF"
ws.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False, _
From:=A, _
To:=B
Next
Application.ScreenUpdating = True
Application.ScreenUpdating = True
End Sub
有關如何做到這一點的任何意見,將不勝感激。
檢查了這一點:https://msdn.microsoft.com/en-us/library/office/ff838253.aspx – User632716
謝謝,已經測試了下方和完美的作品。 –