VBA Outlook - Defining folder

TheMadTree

New Member
Joined
Mar 23, 2015
Messages
25
Good afternoon everyone,

Ever since I upgraded to Office 365, I keep having the same run time error in my outlook macro:
"Run-time error '-2147221233 (8004010f)':
The attempted operation failed. An object could not be found."

Now it is appearing when I am trying to assign a folder path to a variable:

Rich (BB code):
Option Explicit

Dim ns              As Outlook.NameSpace
Dim MyFolder        As Outlook.Folder

Sub SelectFolder


Set ns = Application.GetNamespace("MAPI")
Set MyFolder= ns.Folders("MailboxName").Folders("Inbox").Folders("SpecificFolder")

End sub

I got the same error last week when I was assigning a specific workbook to a variable wb which was defined as 'set wb as workbook' (which ran previously multiple times without issue). I solved it by changing the way the variable was defined: 'set wb as object'.

Am I missing something? Does anybody know what is causing these errors? Or what I can do to solve them?

Thank you!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,223,702
Messages
6,173,961
Members
452,539
Latest member
delvey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top