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 = "(e-mail address removed)"
.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 = "(e-mail address removed)"
.Subject = "Test Mail"
.ReadReceiptRequested = False
.Send
End With
 

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

Top