mojo
09-13-2000, 10:08 PM
I have the following code which creates an email message using outlook:
Private Sub CBBen_Click()
Dim aplOutlook As Outlook.Application
Dim MailMessage As MailItem
Dim CName As String
Dim JNumber As Integer
CName = FrmMail.TBCName.Text
JNumber = FrmMail.TBJobnumber.Text
Set aplOutlook = CreateObject("Outlook.Application")
Set MailMessage = aplOutlook.CreateItem(olMailItem)
With MailMessage
.To = "bav"
.Subject = "JobTracker Notice: Job Complete"
.Body = "Job number " & JNumber & " for " & CName & " has been completed."
.Send
End With
MsgBox "Message Sent"
Set MailMessage = Nothing
Set aplOutlook = Nothing
End Sub
It works fine except that it only puts the message in the outlook Outbox. Is there another piece of code I have to use in order to actually send the message?
ps I have referenced MS Outlook 9.0 Object Library
Thanks
mojo
Private Sub CBBen_Click()
Dim aplOutlook As Outlook.Application
Dim MailMessage As MailItem
Dim CName As String
Dim JNumber As Integer
CName = FrmMail.TBCName.Text
JNumber = FrmMail.TBJobnumber.Text
Set aplOutlook = CreateObject("Outlook.Application")
Set MailMessage = aplOutlook.CreateItem(olMailItem)
With MailMessage
.To = "bav"
.Subject = "JobTracker Notice: Job Complete"
.Body = "Job number " & JNumber & " for " & CName & " has been completed."
.Send
End With
MsgBox "Message Sent"
Set MailMessage = Nothing
Set aplOutlook = Nothing
End Sub
It works fine except that it only puts the message in the outlook Outbox. Is there another piece of code I have to use in order to actually send the message?
ps I have referenced MS Outlook 9.0 Object Library
Thanks
mojo