CAPtain232
Board Regular
- Joined
- Oct 13, 2011
- Messages
- 197
Can someone help me write a macro to save the active worksheet as a PDF with filename referencing cell A1
Thank you
Thank you
Public Sub Save_Multiple_Sheets_As_One_PDF()
Dim currentSheet As Worksheet
Dim p As Long
With ThisWorkbook
Set currentSheet = .ActiveSheet
.Worksheets(Array("Sheet5", " Sheet6", " Sheet8", " Sheet10", " Sheet11", " Sheet14", " Sheet15")).Select
p = InStrRev(.FullName, ".")
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Left(.FullName, p - 1) & " Multiple Sheets.pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
currentSheet.Select
End With
End Sub
This includes the workbook name before "Multiple Sheets.pdf":
Code:Public Sub Save_Multiple_Sheets_As_One_PDF() Dim currentSheet As Worksheet Dim p As Long With ThisWorkbook Set currentSheet = .ActiveSheet .Worksheets(Array("Sheet5", " Sheet6", " Sheet8", " Sheet10", " Sheet11", " Sheet14", " Sheet15")).Select p = InStrRev(.FullName, ".") .ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Left(.FullName, p - 1) & " Multiple Sheets.pdf", _ Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False currentSheet.Select End With End Sub
Welcome to MrExcel, however could you start a new thread please, with an appropriate title.
- <section>Hello, I am exporting a file from Excel to PDF through a Macro. The file consists of a table of contents and several worksheets. The table of contents is hyperlinked to all the separate sheets in the document while on Excel format.
When exporting to PDF however I lose the hyperlinks. Do you have any suggestions on how to solve this problem?
I have bought Adobe Pro and have activated the “Add links” check box under the ACROBAT – preferences tab.
</section>
Hello everyone.
I am copying one value from a sheet and pasting in cell "E5" of the Print sheet tab.
This sheet has different vlookup formulas in different cells and pasting that value in E5 updates the value in other cells automatically.
Now I want to take a print/save pdf for this sheet and I need this copy from column B2 down to B96 and paste it in cell E5 of the sheet one by one and everytime it paste that value the print sheet is automatically saved with a new file name and the process continues untill all the 96 pages are saved as pdf with different values but same columns in it.
Your help will be really appreciated. I tried to do it via macro recorder however that is even painful than doing it all manually.