graviz
Registered User.
- Local time
- Yesterday, 18:05
- Joined
- Aug 4, 2009
- Messages
- 167
I know I'm missing something pretty basic but I cannot get this to work:
Public Function test2()
Dim OL As Object, MailSendItem As Object
Dim CompM As String
Set OL = CreateObject("Outlook.Application")
Set MailSendItem = OL.CreateItem(olMailItem)
CompM = "Select 30_Day_Latest_Week.Comp%" & _
"From 30_Day_Latest_Week"
With MailSendItem
.Subject = "Completion Rate"
.HTMLBody = .HTMLBody & "<body><font color=#3333FF>"
.HTMLBody = .HTMLBody & "<p><b>Completion %: " & CompM & "</b></p>"
.HTMLBody = .HTMLBody & "</font></body>"
.To = ""
.CC = ""
.Importance = 2 ' olImportanceHigh
.Display
.Send
End With
End Function
The thing I can't figure out is what it won't give the output of my SQL code in the e-mail. When I run this it just e-mails the SQL statement and not the value. What am I missing?
Public Function test2()
Dim OL As Object, MailSendItem As Object
Dim CompM As String
Set OL = CreateObject("Outlook.Application")
Set MailSendItem = OL.CreateItem(olMailItem)
CompM = "Select 30_Day_Latest_Week.Comp%" & _
"From 30_Day_Latest_Week"
With MailSendItem
.Subject = "Completion Rate"
.HTMLBody = .HTMLBody & "<body><font color=#3333FF>"
.HTMLBody = .HTMLBody & "<p><b>Completion %: " & CompM & "</b></p>"
.HTMLBody = .HTMLBody & "</font></body>"
.To = ""
.CC = ""
.Importance = 2 ' olImportanceHigh
.Display
.Send
End With
End Function
The thing I can't figure out is what it won't give the output of my SQL code in the e-mail. When I run this it just e-mails the SQL statement and not the value. What am I missing?