Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 563
- Office Version
- 365
- 2010
- Platform
- Windows
On my spreadsheet I have a invoice template with an activex button. When that button is clicked it converts spreadsheet to a pdf and saves it to a designated location and attaches it to an email to be sent. Everything works except the attaching it to an email. My laptop has Office 365 built into it but the trial expired on it, so I installed my older version of Office 2010 since I already had the product key for it.
I created a module called Public_Variables and in that module I have a variable called
Below is the rest of the code used.
I'm getting the error of Run-Time Error '287: Application-defined or object-defined error from the below sub on this line
Thank You
I created a module called Public_Variables and in that module I have a variable called
Code:
Public sPathSaved As String
VBA Code:
Private Sub btnSave_Email_Click()
Dim sPath As String
Dim sFilename As String
'sPath = "C:\Users\username\Desktop\Saved PDF TEST\"
sPath = "C:\Users\username\Desktop\Saved PDF Test\"
sFilename = Range("A7").Text
ActiveSheet.ExportAsFixedFormat xlTypePDF, sPath & sFilename
sPathSaved = sPath & sFilename & ".pdf"
Call send_Email
End Sub
Code:
Set OutMail = OutApp.CreateItem(olMailItem)
Code:
Sub send_Email()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = New Outlook.Application
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.attachments.Add "C:\Users\Jacob B Cutler\Desktop\Saved PDF TEST\"
End With
End Sub
Thank You