Workbook.Open doesn't leave an open Workbook

  • Thread starter Thread starter Mac Lingo
  • Start date Start date
M

Mac Lingo

My Code:

TS = Directory & File_Name
On Error Resume Next
Workbooks.Open TS
If Err Then
Call MsgBox("Could not open " & TS & ", " & Err)
End If

After this runs, there is no Error Message, but there is no Workbook open
either.
This code works if I put in Workbook_Open, but not if I use it in a normal
Function call.

Any idea why it works in one place and not in another?

Thanks,
Mac
 
Your code worked ok for me.

Guess #1. Any chance that that TS was opened, but was hidden (or you didn't
notice it)?

Guess #2. Any chance that you have your own variable named Err?
 
Thanks, Dave, for the response.
But the end result of the process is that the Workbook has not been opened
from the code that is not in the Workbook_Open call.
 
What happens when you step through the code (F8's)?

And if you look at the VBE, do you see the project for that workbook?

And you did check under window|unhide to make sure it wasn't hidden?

If you copy the significant portion of that code to a new workbook and run it
there, does it work?

How do you run this macro? Is it just alt-f8 and point and click or what?
 
Back
Top