Is this file in your current path settings (I'm betting it's not). If you include the path in the file name, it won't matter what path you are currently in. For example, if the file resides in C:\Data and your current path (what you see when you select file open, for instance) is D:\Files, then you will get this error message.
Does this help you out?
BarrieBarrie Davidson
Both files are in the same folder so I don't think this is my problem
Lewis
That's not what I was saying. What is the full path and file name of the file you are opening (e.g., C:\Trainingdb1.xls)? When you select File|Open (in Excel, not via VBA), what is the path?
BarrieBarrie Davidson
The open file with the Macro is C:\My Documents\General\ISO bits\Training Update.xls
And the file it is trying to open
C:\My Documents\General\ISO bits\Trainingdb1.xls
What is the significance of the colon before the equals sign?
Lewis
The colon before the equals sign is the syntax Excel requires to pass on the variable.
You have not answered my other question - When you select File|Open from the main menu, what is the path name Excel is looking in (box labeled "Look in" when the File Open box opens up)?
BarrieBarrie Davidson
Both are in C:\My Documents\General\ISO bits
Lewis
Boy, this is tough doing this via the board. I'm not asking the location of the files. The problem you are having is because Excel's default location (for lack of a better term) is not currently set to "C:\My Documents\General\ISO bits\".
At any rate, change your code to read:
Workbooks.Open Filename:="C:\My Documents\General\ISO bits\Training Update.xls"
This eliminates the need for Excel to be in the specific directory in order for your macro to work.
I think this should solve your problem. If not, just let me know via this board.
Sincerely,
BarrieBarrie Davidson
That has fixed it
Thanks very much for your patient help!
Lewis