20210210 1407 

 

codes

Sub zPrint()
Sheets("report1").Activate
zpath = ActiveWorkbook.Path
zFile = zpath & "\_investment proposal.pdf"
Dim zsh_array() As String

For i = 1 To ActiveWorkbook.Sheets.Count
  If Left(Worksheets(i).Name, 6) = "report" Then
   znmb_report = znmb_report + 1
  End If
Next i
ReDim zsh_array(1 To znmb_report)

j = 1
For i = 1 To ActiveWorkbook.Sheets.Count
  If Left(Worksheets(i).Name, 6) = "report" Then
   zsh_array(j) = Worksheets(i).Name
   j = j + 1
  End If
Next i

Sheets(zsh_array).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
                                Filename:=zFile

Sheets("report1").Select
Range("a1").Select
End Sub

below will print multiple sheets at one shot(instead of PDF)

Sheets(Array("report1", "report2")).Select
ActiveWindow.SelectedSheets.PrintOut Printtofile:=True, _
             Copies:=1, _
             Collate:=True, _
             IgnorePrintAreas:=False
Posted by Weneedu
,


출처: https://privatedevelopnote.tistory.com/81 [개인노트]