check to see if a file is open
I'm using the code below to display a dialog box for the user to select a
file. I'm then checking to see if the file is opened. However, it appears
the code is running faster than the file opens and I and getting the error
message that the file was not opened when in fact it is.
Is there a way to do slow down the code until the file is opened without
coding a hard pause of X number of seconds?
Any help or suggestion would be greatly appreciated. Thanks!
FName = Application.GetOpenFilename
If FName < False Then
Workbooks.Open (FName)
End If
If Workbooks.Count < Wcount + 1 Then
MsgBox "The file was not opened."
Sheets("Macros").Activate
End If
code continues here.......
--
JT
|