Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"File cannot be closed for one of the following reasons" - Any Ideas?

Status
Not open for further replies.

Axeman1

Programmer
Oct 1, 2002
2
GB
Hi,

Has anybody come across the above message. What is basically happening is I'm trying to close down a window with a VBA script running in it. And a message box if appearing with

"Warning" Error Number 0 (00000000)
File cannot be closed for one of the following reasons.
1. Script may be running or paused.
2. A modal box is displayed in VBA.
3. The file is currently opening.

And an 'OK' button

Now I don't mind it coming up with this as it a genuine error but what I would really like to do is trap it so that I can close the window down when it is finished running. Unfortunately it appears not to be a trappable error!

Has anyone any ideas how I can trap it or use some sort of API call to disable it, or how they managed to get around it.

Any comments gratefully recieved,

Paul
 
Hi Paul,

Wouldn't it be better to close the window in the VBA code, after all the other stuff is finished ? (e.g. Application.Quit)

Regards, SteveB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top