Johnnycat1
Programmer
Hello...
I am trying to add an access report to an email using the .attachments.add method but I would prefer to not save the attachment outside of access. I am getting the "Object variable or With Block Variable not set" error.
Any help is greatly appreciated.
My code is currently:
nanos gigantum humeris insidentes
A dwarf on the shoulders of giants...
I am trying to add an access report to an email using the .attachments.add method but I would prefer to not save the attachment outside of access. I am getting the "Object variable or With Block Variable not set" error.
Any help is greatly appreciated.
My code is currently:
Code:
Private Sub EmailLetterBtn_Click()
On Error GoTo Err_EmailBtn_Click
'References Microsoft Outlook 15.0 Object Library
Dim strAttach As AccessObject
Dim MyApp As New Outlook.Application
Dim MyItem As Outlook.MailItem
Set MyItem = MyApp.CreateItem(olMailItem)
strAttach = "Letter Select Rpt"
With MyItem
.Subject = Project_Name & " " & Subject
.ReadReceiptRequested = True
.HTMLBody = Letter_Text
.Attachments.Add (strAttach)
End With
MyItem.Display
nanos gigantum humeris insidentes
A dwarf on the shoulders of giants...