alam747
asked on
Getting error in collecting an attachment from outlook mail
Hi,
I am geting VBA runtime error -2147221233(8004010f)
The attempted operation failed.An object could not be found.
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim ns As Outlook.Namespace
Dim Inbox As MAPIFolder
Set olApp = CreateObject("Outlook.Appl ication")
Set ns = olApp.GetNamespace("MAPI")
I am geting the above runtime error in below VBA line:
Set Inbox = ns.Session.Folders("Mailbo x - test").Folders("Inbox")
Your prompt response would be highly appreciated.
Thanks
references.jpg
I am geting VBA runtime error -2147221233(8004010f)
The attempted operation failed.An object could not be found.
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim ns As Outlook.Namespace
Dim Inbox As MAPIFolder
Set olApp = CreateObject("Outlook.Appl
Set ns = olApp.GetNamespace("MAPI")
I am geting the above runtime error in below VBA line:
Set Inbox = ns.Session.Folders("Mailbo
Your prompt response would be highly appreciated.
Thanks
references.jpg
ASKER
Yes, I have generic mailbox named test.
Did you try the code I posted?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi mibizup,
I tested the example code check the result and modified as below then it works.
I removed the mailbox and it works, I updated as below:
Set Inbox = ns.Session.Folders("test") .Folders(" Inbox")
Thanks for your help
I tested the example code check the result and modified as below then it works.
I removed the mailbox and it works, I updated as below:
Set Inbox = ns.Session.Folders("test")
Thanks for your help
Your overall syntax is fine... but I think you might need to correct your mailbox name (I would think that the mailbox name should be the email address concerned.
Try this as a test instead, to verify that your code works ...
Open in new window