Problem sending mail from MSACCESS to Outlook

J

Jyothi

Hi All,

I am trying to send an email from MSACCESS (VBA) . But the code i
hanging. Please tell me what is wrong! in my code.

Dim strErrMsg As String 'For Error Handling
Dim olApp As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olMail As Outlook.MailItem

Set olNameSpace = olApp.GetNamespace("MAPI")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = "[email protected]"
.Subject = "Test Mail"
.ReadReceiptRequested = False
.Send
End With

Thanks in advanc
 
S

Sue Mosher [MVP-Outlook]

You omitted the period before the property and method statements in your With block:

With olMail
.To = "[email protected]"
.Subject = "Test Mail"
.ReadReceiptRequested = False
.Send
End With
 
Top