I'm developing a drag and drop of a MailItem from Outlook (I know it's a MailItem and not any other type) into an Access memo field. Trying to call SaveAs on a MailItem object.
I get
Error 287 - Application-defined or object-defined error.
I've tried using the namespace, not using the namespace, using .Item, etc.
Here's my current code:
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olNs As Outlook.NameSpace
Set olNs = olApp.GetNamespace("MAPI")
Dim olMail As Outlook.MailItem
Set olMail = olNs.GetItemFromID(olNs.Application.ActiveExplorer.Selection(1).EntryID)
olMail.SaveAs strPathAndFile, Outlook.OlSaveAsType.olMSG
Access 2010, Outlook 2010 both 32 bit. Win 7 machine is 64 bit.
Tried it on an all 32-bit machine, same error.
Tried Dmitry's code below, same error.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…