GetOpenFilename code execution interrupted

J

John

This code has been running for three years. All of a sudden I get "Code
execution has been interrupted" in the next line after
Application.GetOpenFilename. No matter what the user chooses (a file or
cancel). Is there a way to stop that without disabling the cancel
selection?
Thanks

John




ChDir "C:\Documents and Settings\Administrator\Desktop\Billing\State"
StateBilledFile = Application.GetOpenFilename("Excel Files,_
*.xls),Title:=,Open a Nancy + date.xls file")

' Test if Cancel button was clicked.
Select Case StateBilledFile
Case Is <> False
Workbooks.Open (StateBilledFile)
 
R

Rich Locus

Hello:
If your code has been running for 3 years and now suddenly it stops, you
probably have an error in your Operating System or Excel has been corrupted.
I've been down similar roads. On my last unexplained behavior, after beating
my head against the wall, I finally did a system restore to an earlier state
and it fixed my issue.

Try running it in the debugger line by line if you haven't done that already
and maybe you can get a hint.
 
J

John

Yeah, I ran it line by line. At GetOpenFilename it just says the same
thing. If I click continue the macro goes on perfectly.

It's as if the getopenfilname demands an interruption before going on
with a choice to continue or stop.

I can't think of anything new on the computer. It's vista with normal
upgrades.

It looks like I will just have to tell the users this is what happens
and click continue.

John
 
J

John

If I run the exact same code on windows 7, office 2007 the "interrupt"
doesn't occur. So something has happend to office 2003 or vista on the
other computer to make this happen. Does anyone know what it could be?

JOhn
 
R

Rich Locus

John:

Normal updates to systems will sometimes cause issues with code... rare, but
it happens. Try looking at the Windows Event Viewer around the time it
happens and see if it gives you any more information. It is for this very
reason that Microsoft gives you the ability to roll back updates, and also
has a system restore feature.

These issues are tough to track down, but try the same program on a
different Vista machine and see if it happen on another workstation. If not,
then the current Vista machine may have issues.
 
J

John

Rich said:
John:

Normal updates to systems will sometimes cause issues with code... rare, but
it happens. Try looking at the Windows Event Viewer around the time it
happens and see if it gives you any more information. It is for this very
reason that Microsoft gives you the ability to roll back updates, and also
has a system restore feature.

These issues are tough to track down, but try the same program on a
different Vista machine and see if it happen on another workstation. If not,
then the current Vista machine may have issues.

I went back to the machine to try a fix using on error but the thing had
stopped happening. Have no idea why.

I just left instructions to click "continue" if it happens again. That's
good enough for me right now. I can see hours put in to find the culprit
and it really doesn't matter if it doesn't screw anything up.
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top