问题
We have an Access Database running for quite a few years under "Office 2010" but now we have to change to Office 365 and are getting this annoying error with the code below:
Dim olAppSaida As Outlook.Application
Dim olItemSaida As Outlook.MailItem
Set olAppSaida = CreateObject("Outlook.application")
Set olItemSaida = olAppSaida.ActiveInspector.CurrentItem
If Not TypeName(olItemSaida) = "Nothing" Then
olItemSaida.SaveAs "C\TEstes\" & strProcesso & ".Msg", olMSGUnicode
End If
The reference to Outlook XX.X library is checked, but the error ocurrs in the line:
"olItemSaida.SaveAs "C\TEstes\" & strProcesso & ".Msg", olMSGUnicode"
Can anyone help, please?
回答1:
Problem solved.
It was all about Security Policies for Outlook 2016.
Now the code runs like it ever did.
Thanks anyway.
回答2:
- Make sure the path string is correct.
- Try to specify another type to save with -
OlSaveAsType
. - It may be a security issue when automating Outlook from an external application. See "A program is trying to send an e-mail message on your behalf" warning in Outlook for more information.
来源:https://stackoverflow.com/questions/57204574/outlook-2016-run-time-error-287-application-defined-or-object-defined-erro