For many years I have used the following vb code to create an Outlook email from Access, add an attachment, and display it in Outlook before sending. Now that I have Office 2007 Pro under Vista HP, it no longer works under Access 2000, nor 2007. Either the process stops after the attachment is created and saved, and the created email disappears, or sometimes I get the Outlook security box, and I click OK to allow access to Outlook and then the email disappears.
Without the attachment, the email is created OK and displays - with an attachment, nothing!
It seems to me that Outlook has some new feature that does not allow remote attachments, but I can't find anything to resolve this problem.
Any help or clues appreciated.
=====================================
MyStr = MSA_SimpleGetSaveFileName3(MyReport)
DoCmd.OutputTo acOutputReport, MyReport,acFormatRTF, MyStr, 0
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecipTo = .Recipients.Add(Anyone)
objOutlookRecipTo.Type = olTo
objOutlookRecipTo.Resolve
.Subject = "Any subject"
.Body = "Anything..."
.Importance = olImportanceHigh
.Attachments.Add (MyStr)
.Display
End With
Set objOutlook = Nothing
=========================================
end
Without the attachment, the email is created OK and displays - with an attachment, nothing!
It seems to me that Outlook has some new feature that does not allow remote attachments, but I can't find anything to resolve this problem.
Any help or clues appreciated.
=====================================
MyStr = MSA_SimpleGetSaveFileName3(MyReport)
DoCmd.OutputTo acOutputReport, MyReport,acFormatRTF, MyStr, 0
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecipTo = .Recipients.Add(Anyone)
objOutlookRecipTo.Type = olTo
objOutlookRecipTo.Resolve
.Subject = "Any subject"
.Body = "Anything..."
.Importance = olImportanceHigh
.Attachments.Add (MyStr)
.Display
End With
Set objOutlook = Nothing
=========================================
end