Setting Message Priority in Visual Basic

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top