T
triad
I need to write a procedure to e-mail an open report thru Access. I have the
following code that works except for the attachment. I need to find a way to
attach the open report instead of the file "E:\Access\Accounts.rtf."
Function ap_CreateOLEMailItem()
Dim objMailItem As Outlook.MailItem
Dim myattachments As Outlook.Attachments
Set olkApp = New Outlook.Application
Set olkNameSpace = olkApp.GetNamespace("MAPI")
Set objMailItem = olkApp.CreateItem(olMailItem)
Set myattachments = objMailItem.Attachments
myattachments.Add "E:\access\accounts.rtf", olByValue, 1, "Test"
With objMailItem
.Display
End With
Set objMailItem = Nothing
Set olkNameSpace = Nothing
Set olkApp = Nothing
End Function
I could use the following function but it opens a different version of the
e-mail send program that I don't want to use:
Function ap_CreateOLEMailItem()
DoCmd.SendObject acSendReport, , acFormatRTF, , , , "Purchase Order",
"Please process and confirm this order. Thanks."
End Function
Any suggestions would be appreciated.
following code that works except for the attachment. I need to find a way to
attach the open report instead of the file "E:\Access\Accounts.rtf."
Function ap_CreateOLEMailItem()
Dim objMailItem As Outlook.MailItem
Dim myattachments As Outlook.Attachments
Set olkApp = New Outlook.Application
Set olkNameSpace = olkApp.GetNamespace("MAPI")
Set objMailItem = olkApp.CreateItem(olMailItem)
Set myattachments = objMailItem.Attachments
myattachments.Add "E:\access\accounts.rtf", olByValue, 1, "Test"
With objMailItem
.Display
End With
Set objMailItem = Nothing
Set olkNameSpace = Nothing
Set olkApp = Nothing
End Function
I could use the following function but it opens a different version of the
e-mail send program that I don't want to use:
Function ap_CreateOLEMailItem()
DoCmd.SendObject acSendReport, , acFormatRTF, , , , "Purchase Order",
"Please process and confirm this order. Thanks."
End Function
Any suggestions would be appreciated.