andrewbecks
New Member
- Joined
- May 23, 2008
- Messages
- 2
Good afternoon.
I have an Access 2003 database and in it, there is a query called Mobile View. I'd like to send the results of the query in a e-mail as the body of the e-mail (not as an attachment).
Below is the module that I'm trying to use. The problem is that when the module gets to the Dim MyItem As Outlook.MailItem line, it returns the following error: "Compile error: User-defined type not defined".
Can someone please help me figure out the issue?
Thank you so much in advance.
I have an Access 2003 database and in it, there is a query called Mobile View. I'd like to send the results of the query in a e-mail as the body of the e-mail (not as an attachment).
Below is the module that I'm trying to use. The problem is that when the module gets to the Dim MyItem As Outlook.MailItem line, it returns the following error: "Compile error: User-defined type not defined".
Can someone please help me figure out the issue?
Thank you so much in advance.
Rich (BB code):
Sub RTFBodyX()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f
Dim RTFBody, strTo
Dim MyItem As Outlook.MailItem
Dim MyApp As New Outlook.Application
DoCmd.OutputTo acOutputQuery, "Mobile View", acFormatHTML, "Mobile View.htm"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("Mobile View.htm", ForReading)
RTFBody = f.ReadAll
'Debug.Print RTFBody
f.Close
Set MyItem = MyApp.CreateItem(olMailItem)
With MyItem
.To = "abecks@rubytuesday.com"
.Subject = "txtSubjectLine"
.HTMLBody = RTFBody
End With
MyItem.Display
End Sub