10 replies
by dklippert
SendObject is the action. You can contstruct a macro to do this.
For instructions, type e-mail in the keyword box on the index tab of the Help file.
Here's an article. (Faxing and sending e-mail are the same)
TYpe the Q number in the search boxat support.microsoft.com
How to Fax from Microsoft Access Using SendObject Command
Q145787
by mrs mrs
by chrissaw
Hi mrs MRS,
Here the procedure I use to do what you want to do. Just call the Proc by Call SendEmail.
You have to use your table name instead of mine ie, "tblConstantesOutlook" and the field name GLO_EMAIL_TO by your field name containing email address.
I took off all error handling and comments to fit in this textbox.
Hope it will help.
Christian
Public Sub SendEmail()
Dim dbOutlook As DAO.Database
Dim recOutlook As DAO.Recordset
Dim oOutlookApp As Outlook.Application
Dim oMailItem As Outlook.MailItem
Dim oNameSpace As Outlook.NameSpace
Dim pAttachment As Outlook.Attachments
Dim strNewFName As String
Dim strFName As String
On Error Resume Next
Set oOutlookApp= GetObject(Class:="Outlook.Application")
If oOutlookApp Is Nothing Then
Set oOutlookApp = New Outlook.Application
End If
If oOutlookApp Is Nothing Then
MsgBox "Did not get Outlook instance" & vbCrLf _
& Err.Number & " " & Err.Description, vbInformation
Exit Sub
End If
Set dbOutlook = CurrentDb
Set recOutlook = dbOutlook.OpenRecordset("yourTableName", dbOpenDynaset)
Set oMailItem = oOutlookApp.CreateItem(olMailItem)
SetoNameSpace = oOutlookApp.GetNamespace("MAPI")
Set pAttachment = oMailItem.Attachments
Call oMailItem.Recipients.Add(Trim(recOutlook![GLO_EMAIL_TO]))
oMailItem.Subject = Trim(recOutlook![GLO_EMAIL_SUBJECT])
If IsNoData(glbEmailBodyComments) Then
oMailItem.Body = Trim(recOutlook![GLO_EMAIL_BODY])
Else
oMailItem.Body = glbEmailBodyComments
End If
pAttachment.Add Trim(recOutlook![GLO_EMAIL_PATH]) & Trim(recOutlook![GLO_EMAIL_ATTACHMENT]), olByValue
oMailItem.Save
oMailItem.Send
Set oMailItem = Nothing
Set oNameSpace = Nothing
Set pAttachment = Nothing
oOutlookApp = Nothing
End Sub
by chrissaw
Hi ,
I just send you email describing how I work with that.
Christian
by chrissaw
Hi again,
I forgot to tell you that you must add a reference to your Access database for Microsoft Outlook 8.0 or 9.0 or 10.0 Library depending of your release of Office.
Christian
by mrs mrs
by mrs mrs
by timfox
Check out this web site (it was referred to me by another TechRepublic user ages ago.
http://www.granite.ab.ca/access/email.htm
I used the references there to send mail with a Lotue Notes client - which worked great, but I haven't had to use the Outlook MAPI method.
Hope it helps.
by mrs mrs
by mrs mrs
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending