Gavin Harrison
New Member
- Joined
- May 2, 2017
- Messages
- 34
Hi.
I have the below code that works fine to save my workbook as a PDF where the user specifies the location but the filename is specific. I now require if to still be an excel file.
I would also like to add in to the code the ability to delete several of the worksheets within the new workbook to reduce the file size as this file will be saved over and over again.
This is my original code:
Sub Save_Excel_as_PDF()
strfile = ThisWorkbook.Path & "" & strfile
myfile = Application.GetSaveAsFilename _
Application.ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:=Sheets("Great Rooms Report").Range("AI3").Text _
MsgBox "Your report has been saved to the selected folder named as: " & Range("AI3").Value & "."
End Sub
Many thanks
Gavin
I have the below code that works fine to save my workbook as a PDF where the user specifies the location but the filename is specific. I now require if to still be an excel file.
I would also like to add in to the code the ability to delete several of the worksheets within the new workbook to reduce the file size as this file will be saved over and over again.
This is my original code:
Sub Save_Excel_as_PDF()
strfile = ThisWorkbook.Path & "" & strfile
myfile = Application.GetSaveAsFilename _
Application.ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:=Sheets("Great Rooms Report").Range("AI3").Text _
MsgBox "Your report has been saved to the selected folder named as: " & Range("AI3").Value & "."
End Sub
Many thanks
Gavin