shmulikharel
New member
- Local time
- Today, 21:26
- Joined
- May 22, 2010
- Messages
- 1
Okay, after many attempts I managed to create options for sending email via Access:
Is necessary to:
1. Outlook program installed on your computer.
2. Add in the "References" the Type "Microsoft Outlook 12.0 object library" ... See More
To Send a single email:
<StartCode>
Dim olApp As Object
Dim objMail As Object
On Error Resume Next 'Keep going if there is an error
Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open
If Err Then 'Outlook is not open
Set olApp = CreateObject("Outlook.Application") 'Create a new instance of Outlook
End If
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.To = "Your Mail"
.Subject = "Subject"
.HTMLBody = "Text"
.send
End With
MsgBox "Operation completed successfully"
<EndCode>
Thanks and good luck everyone!!
Is necessary to:
1. Outlook program installed on your computer.
2. Add in the "References" the Type "Microsoft Outlook 12.0 object library" ... See More
To Send a single email:
<StartCode>
Dim olApp As Object
Dim objMail As Object
On Error Resume Next 'Keep going if there is an error
Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open
If Err Then 'Outlook is not open
Set olApp = CreateObject("Outlook.Application") 'Create a new instance of Outlook
End If
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.To = "Your Mail"
.Subject = "Subject"
.HTMLBody = "Text"
.send
End With
MsgBox "Operation completed successfully"
<EndCode>
Thanks and good luck everyone!!
Last edited: