K
kvogelgesang
Hi all,
I have an Access 2000 Database that is programed to send out emails and
is working fine except i would like to change the message priority to
High so it buzzes people using blackberries when they recieve it.
Below is my code to send the emails and i added a line "olMail.Priority
= MailPriority.High" to try and set the priority. since i added it i
recieve an error stating "SendEmail: Object Required". Can anyone
help?
Sub SendEmail(strTo As String, Optional MessageID As Integer = 0)
On Error GoTo Err_SendEmail
Dim olApp As New Outlook.Application
Dim olNs As Outlook.NameSpace
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = strTo
olMail.Subject = txtMsgSubject.Value
olMail.Body = txtMsgBody.Value & vbCrLf & "MsgID:" & MessageID
olMail.Priority = MailPriority.High 'Added this line to change the
priority and now it fails
olMail.Send
olNs.Logoff
Set olNs = Nothing
Set olMail = Nothing
Set olApp = Nothing
Exit_SendEmail:
Exit Sub
Err_SendEmail:
WriteToLog ("SendEmail: " & Err.Description)
Resume Exit_SendEmail
End Sub
I have an Access 2000 Database that is programed to send out emails and
is working fine except i would like to change the message priority to
High so it buzzes people using blackberries when they recieve it.
Below is my code to send the emails and i added a line "olMail.Priority
= MailPriority.High" to try and set the priority. since i added it i
recieve an error stating "SendEmail: Object Required". Can anyone
help?
Sub SendEmail(strTo As String, Optional MessageID As Integer = 0)
On Error GoTo Err_SendEmail
Dim olApp As New Outlook.Application
Dim olNs As Outlook.NameSpace
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = strTo
olMail.Subject = txtMsgSubject.Value
olMail.Body = txtMsgBody.Value & vbCrLf & "MsgID:" & MessageID
olMail.Priority = MailPriority.High 'Added this line to change the
priority and now it fails
olMail.Send
olNs.Logoff
Set olNs = Nothing
Set olMail = Nothing
Set olApp = Nothing
Exit_SendEmail:
Exit Sub
Err_SendEmail:
WriteToLog ("SendEmail: " & Err.Description)
Resume Exit_SendEmail
End Sub