NAVYTECH79
New Member
- Joined
- Jul 9, 2015
- Messages
- 11
Hello everyone,
I have been searching this website as well as google for a week now and haven't found any examples that a novice like myself can modify to make work.
I am trying to automatically populate an email with the results of 3 different queries. I have been able to successfully populate one query into the email, but I'm not sure where to go next. Any help would be greatly appreciated. Below is the current vba code I am using:
Sub RTFBodyX()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f,
Dim RTFBody1, strTo
Dim Body1
Dim MyItem As Outlook.MailItem
Dim MyApp As New Outlook.Application
DoCmd.OutputTo acOutputQuery, "BUQuery", acFormatHTML, "BUQuery.htm"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("BUQuery.htm", ForReading)
RTFBody1 = f.ReadAll
f.Close
Set MyItem = MyApp.CreateItem(olMailItem)
With MyItem
.To = "email@test.com"
.Subject = "Test Subject"
'.HTMLBody = RTFBody1
End With
MyItem.Display
End Sub
I have been searching this website as well as google for a week now and haven't found any examples that a novice like myself can modify to make work.
I am trying to automatically populate an email with the results of 3 different queries. I have been able to successfully populate one query into the email, but I'm not sure where to go next. Any help would be greatly appreciated. Below is the current vba code I am using:
Sub RTFBodyX()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f,
Dim RTFBody1, strTo
Dim Body1
Dim MyItem As Outlook.MailItem
Dim MyApp As New Outlook.Application
DoCmd.OutputTo acOutputQuery, "BUQuery", acFormatHTML, "BUQuery.htm"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("BUQuery.htm", ForReading)
RTFBody1 = f.ReadAll
f.Close
Set MyItem = MyApp.CreateItem(olMailItem)
With MyItem
.To = "email@test.com"
.Subject = "Test Subject"
'.HTMLBody = RTFBody1
End With
MyItem.Display
End Sub