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
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