Object Variable or With Block Not Set Error in Outlook 2016 and not Outlook 2013

Status
Not open for further replies.

Jake

New Member
Outlook version
Outlook 2013 32 bit
Email Account
POP3
Hello,

I've written a macro to iterate through a specific folder in my Outlook and send a canned reply to all emails within. The code to find the folder came from slipstick.com and it has proven very useful however I am having a significant issue.

On my machine and that of another coworker, all of which run Outlook 2013, the macro runs fine. There are no errors, all emails are sent replies, and the people who expect those emails are happy they come each and every time.

I am using the GetFolderPath function from this page:

Working with VBA and non-default Outlook Folders

However there is at least one machine in the office which runs Outlook 2016 and my code is giving me an error when I attempt to execute it there. The error is Object Variable or With Block Not Set. I come to the final iteration of the loop and the function call returns NULL.

Looking at the variables and objects as the If loop runs, I can see some discrepancies between what is happening on my machine and what is happening on the workstation which is receiving an error. On the same iteration of the loop and in the same part of the function, SubFolders.Item(FoldersArray(i)) is set to the name of the folder on the functioning machine however on the machine where the error occurs, it says: <The Attempted Operation Failed. An object cannot be found>.

So naturally, calling the function to retrieve the value of oFolder will result in a NULL value and an error occurs.

Can anyone explain to me why this is the case? I've been trying to wrap my head around this for a few weeks.

Thank you!

*EDIT* typo
 
The email accounts are identical according to my IT staff. They are all POP3 accounts set up with an outside vendor.

Could the object type for the SubFolders object be different between the two Outlook versions?
 
The error simply means the subfolder doesn't exist. There's no difference between the versions of Outlook; however, it looks like the folder hierarchy isn't identical on all your machines.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
V Outlook Error The Attempted operation Failed. An Object Could Not be found Outlook VBA and Custom Forms 0
R How to get the Items object of the default mailbox of a specific account in a multiple account Outlook? Outlook VBA and Custom Forms 0
A Run time error 424. object required in outlook 2013 Outlook VBA and Custom Forms 10
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
P Automate Outlook Start - No Active Explorer Object Found Using Outlook 10
J Outlook 2016 is killing me with object.links Outlook VBA and Custom Forms 2
S how to access the properties of a contact given distlist.member object Outlook VBA and Custom Forms 1
J An attempt operation failed. An object could not be found at line5. Outlook VBA and Custom Forms 2
R How can I retain embedded object with voting button reply? Using Outlook 5
G run-time 438: object doesn't support this property or method Using Outlook 2
B Task List in To-Do Bar 'The operation failed. An object could not be found' Using Outlook 3
A vb6 run time error 5 when Outlook 2007 Explorer object displayed Outlook VBA and Custom Forms 1
P Problem with a Search-Object resulting from an AdvancedSearch Outlook VBA and Custom Forms 2
T How to get Inspector object from Window handle Outlook VBA and Custom Forms 2
M MailItem object has no property for when a reply was sent Outlook VBA and Custom Forms 3
M Outlook Contact Object: Is there a "last accessed" date-time prope Outlook VBA and Custom Forms 3
M Cannot Send - "Operation failed. An object cannot be found" BCM (Business Contact Manager) 4
K How to disconnect Application.COMAddIns.Item().Object? Outlook VBA and Custom Forms 4
S RDOMail object is not working in different thread. Outlook VBA and Custom Forms 13
G Error in Outlook Object Model with redemption and google apps prem Outlook VBA and Custom Forms 3
C Unable to cast object of type 'System.Int32' to type 'System.Byte[ BCM (Business Contact Manager) 1
S UserProperties of MailItem object. Outlook VBA and Custom Forms 3
P UserProperty of mail object problem while dealing with custom fold Outlook VBA and Custom Forms 2
J object that has been separated from its underlying RCW Outlook VBA and Custom Forms 11
S How to get RFC822 format message from the MailItem object. Outlook VBA and Custom Forms 4
B Compile error: Object required Outlook VBA and Custom Forms 2
S Strange Behaviour of Explorer Object. Outlook VBA and Custom Forms 1
R Unable to cast COM object" error Outlook VBA and Custom Forms 2
R Unable to cast COM object" error Outlook VBA and Custom Forms 5
R destroying Explorer object pointers on shutdown Outlook VBA and Custom Forms 2
T COM object that has been separated from its underlying RCW Outlook VBA and Custom Forms 1
A How to assign the value returned by the regex execute function to a variable? Using Outlook 1
J Automatic color category according to variable domains Outlook VBA and Custom Forms 4
B InputBox for variable folder Outlook VBA and Custom Forms 7
D Outlook Rules - How to use a variable in the subject condition Outlook VBA and Custom Forms 9
M Modifying Macro MoveAgedMail(2) - use categories & "to" as variable Using Outlook 12
A Outlook VBA - moving mail item to public folder using variable within path Using Outlook 6
E Outlook could not create the work file. Check the temp environment variable Using Outlook 8
C Variable Attachments in CDO/OL2K7? Outlook VBA and Custom Forms 4
M VSTO C#: How do I declare an application scope variable? Outlook VBA and Custom Forms 2
C Outlook - Macro to block senders domain - Macro Fix Outlook VBA and Custom Forms 2
B Modify VBA to create a RULE to block multiple messages Outlook VBA and Custom Forms 0
J How to Block junk/spam domain Using Outlook 0
E Macro to block senders domain Outlook VBA and Custom Forms 1
I Exchange 2019 - MICROSOFT-CORP-MSN-AS-BLOCK Exchange Server Administration 0
N Auto-complete - block select emails Using Outlook 3
L Block email signature image Using Outlook 1
Diane Poremsky Block Macros in Office 2013/2016 Using Outlook 0

Similar threads

Back
Top