Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 563
- Office Version
- 365
- 2010
- Platform
- Windows
The goal I am trying to achieve is to convert a spreadsheet to a pdf, save the pdf to a specified folder, and email that pdf all with a click of a button. However I am stuck on the second part, saving the new converted pdf to a specified file location. Here's what I have so far, everything works great until the last line of code.
I get Runtime error '1004': Application defined or object-defined error.
Thank You
Code:
ActiveWorkbook.SaveAs filename:=sPath
VBA Code:
Private Sub btnSave_Email_Click()
Dim sPath As String
Dim sFilename As String
sPath = "C:\Users\UserName\Desktop\Saved PDF TEST\"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF
ActiveWorkbook.SaveAs filename:=sPath
End Sub
Thank You