Hello,
When I run the macro I would it to save it to a PDF and also choose the name for a PDF based on the worsheet name. I have the macro setup in which its prints the selected sheet but I have to manually enter the name for each PDF. How to write to code so that the name = worksheet name? Below is the code.
Printer can be either Adobe PDF or CutePDF.
Sub PrintAll()
Application.Dialogs(xlDialogPrinterSetup).Show
Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = "t1" Or ws.Name = "t2" Or ws.Name = "Sheet11" Or ws.Name = "Sheet12" Then
Else
ws.Visible = xlSheetVisible
WHAT SHOULD GO HERE SO THAT IT PULLS IN THE WORKSHEET NAME FOR THE SAVE AS DIALOG BOX THAT OPENS UP.
ws.PrintOut
End If
Next ws
Application.DisplayAlerts = True
End Sub
Thanks,
Aadesh Gandhi
Bookmarks