Method Open of Object Workbooks Failed

akforsyt

New Member
Joined
Apr 9, 2009
Messages
18
I need some help with this error. I have some VBA code in Outlook that runs whenever a task reminder goes off. The code is supposed to open a workbook, send email based on the info in the workbook, then close the workbook and quit excel.

The task reminders are set to go off every two hours. Sometimes this will work fine for days and then randomly (as far as I can tell) I get the error: "Method Open of Object Workbooks failed". If I press Debug and then Run without changing anything at all, it works fine.

I am using Outlook 2007 and Excel 2007. The workbook is a shared workbook on a network drive.

I can post code if needed, but will have to go to that computer.

Why do I occasionally get this error when the workbook definitely exists and has the same name and path? What does entering debug mode do that then allows the macro to run without error?
 
@Andrew
I did read the first link you sent. The second link is very helpful in explaining what this means.

@Brian
Everything else I have written has been in Excel referencing Outlook instead of Outlook to Excel. That explains why I was creating Outlook instances. I have learned VBA on my own and so I know I am missing a lot of the background knowledge.
What you explained makes a lot of sense and also explains several things that I have seen: several instances of outlook running, excel processes running after the workbook is closed, etc.

I will rewrite this and add what you and Andrew have suggested and let you know how it goes.

Thank you very much for your help.
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
It's been quite a while since I first posted this. I appreciate everyone's help. I still had some issues with this even after following the recommendations here. What I ended up doing was rewriting my code so that I now use Excel VBA to control Outlook instead of Outlook controlling Excel. I am much more comfortable with Excel and found this easier to do.
 
Upvote 0
I had the same issues. Instead of DoEvents. I just placed a MsgBox forcing the process to halt a while before executing OPEN command.
 
Upvote 0

Forum statistics

Threads
1,214,524
Messages
6,120,049
Members
448,940
Latest member
mdusw

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