ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Runtime error 1004 (https://www.excelbanter.com/excel-programming/329895-runtime-error-1004-a.html)

StephanieH

Runtime error 1004
 
I have an interface that opens certain files based on criteria supplied by
the user. If the user starts the process then cancels out because they've
changed their mind of opening a file, they get a Runtime error 1004.

I'd like to suppress the runtime message and replace it with something along
the lines of
If Fname = Empty then
Msgbox ("You've chosen to not open a file at this time")
or something.

I just don't want it to look like the link isn't working correctly when the
user opts out. How can I suppress this error message specifically?

Dave Peterson[_5_]

Runtime error 1004
 
dim FName as variant
FName = application.getopenfilename
if fname = false then
msgbox "try later"
exit sub
end if



StephanieH wrote:

I have an interface that opens certain files based on criteria supplied by
the user. If the user starts the process then cancels out because they've
changed their mind of opening a file, they get a Runtime error 1004.

I'd like to suppress the runtime message and replace it with something along
the lines of
If Fname = Empty then
Msgbox ("You've chosen to not open a file at this time")
or something.

I just don't want it to look like the link isn't working correctly when the
user opts out. How can I suppress this error message specifically?


--

Dave Peterson

StephanieH

Runtime error 1004
 
Perfect. Thanks Dave.

"Dave Peterson" wrote:

dim FName as variant
FName = application.getopenfilename
if fname = false then
msgbox "try later"
exit sub
end if



StephanieH wrote:

I have an interface that opens certain files based on criteria supplied by
the user. If the user starts the process then cancels out because they've
changed their mind of opening a file, they get a Runtime error 1004.

I'd like to suppress the runtime message and replace it with something along
the lines of
If Fname = Empty then
Msgbox ("You've chosen to not open a file at this time")
or something.

I just don't want it to look like the link isn't working correctly when the
user opts out. How can I suppress this error message specifically?


--

Dave Peterson



All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com