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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 97 VB - Reopen File Message Box Error 1

Status
Not open for further replies.

Particle68

Technical User
Oct 12, 2001
2
CA
Hi All,
I'm fairly new at VB programming in Excel. This site sounds like it's a bit more for the seasoned programmer, but I was wondering if anyone could help me out with the following or suggest a site for newbies.

I wrote some code that prompts the user to open a file (GetOpenFilename), however if the file is already opened a message box pops up warning the user that the file is open and asks the user to reopen the file. Clicking NO generates a bug error (Run-time error '1004': Method 'Open' of object 'Workbooks' failed.

Is there anyway of accessing or checking the return value, vbNo, so that I can incorporate into my code? Or, is there something I'm missing in the code that generates the error?

Cheers,
Rick
 
Hi,

You can always error trapping

on error got label


ok:

label:

if err.number = 1004 then
doSomething ie. Resume or Resume Next or Exit Sub etc
else
msgbox err.description
end if

Let me know if this isn't what u want. Also, this sight isn't aimed at seasoned programmers. It is for absolutely everyone. It is a very good sight to pick up good tips. I try and answer Q's, but I also always ask loads of Q's.

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top