[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Sub[/color] WorksheetsToPDF()
[color=darkblue]Dim[/color] wks [color=darkblue]As[/color] Worksheet
[color=darkblue]Dim[/color] strDestPath [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] strFile [color=darkblue]As[/color] [color=darkblue]String[/color]
strDestPath = "C:\Users\Domenic\Desktop\" [color=green]'change the destination path accordingly[/color]
[color=darkblue]If[/color] Right(strDestPath, 1) <> "\" [color=darkblue]Then[/color] strDestPath = strDestPath & "\"
[color=darkblue]For[/color] [color=darkblue]Each[/color] wks [color=darkblue]In[/color] ActiveWorkbook.Worksheets
strFile = strDestPath & wks.Name & ".pdf"
wks.ExportAsFixedFormat xlTypePDF, strFile
[color=darkblue]Next[/color] wks
MsgBox "Completed...", vbInformation
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]
[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Sub[/color] WorksheetsToPDF()
[color=darkblue]Dim[/color] wks [color=darkblue]As[/color] Worksheet
[color=darkblue]Dim[/color] strDestPath [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] strFile [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=red]Dim strDate As String[/color]
strDestPath = "C:\Users\Domenic\Desktop\" [color=green]'change the destination path accordingly[/color]
[color=darkblue]If[/color] Right(strDestPath, 1) <> "\" [color=darkblue]Then[/color] strDestPath = strDestPath & "\"
[COLOR="Red"]strDate = Format(DateAdd("m", -1, Date), "m-yyyy")[/COLOR]
[color=darkblue]For[/color] [color=darkblue]Each[/color] wks [color=darkblue]In[/color] ActiveWorkbook.Worksheets
[COLOR="Red"]strFile = strDestPath & wks.Name & " " & strDate & ".pdf"[/COLOR]
wks.ExportAsFixedFormat xlTypePDF, strFile
[color=darkblue]Next[/color] wks
MsgBox "Completed...", vbInformation
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]