Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro that opens a workbook off of my server.
I am wanting to be able to display a dialog box that says that the file does not exist and then goto to the end of the macro. As is now I get a runtime error '1004' and you have to end the macro or debug it. I don't want the user to see this error message. Here is the code that opens the workbook: Set destWB = Workbooks.Open("X:\Projects\Group 17 (McLendon)\Group 17 Dayrates\" & wName) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Set destWB = Nothing 'jsut to be sure On ERrror Resume Next Set destWB = Workbooks.Open("X:\Projects\Group 17 (McLendon)\Group 17 Dayrates\" & wName) On Error Goto 0 If destWB Is Nothing Then Msgbox "File does not exist Exit SUb End IF -- HTH RP (remove nothere from the email address if mailing direct) "Judd Jones" wrote in message ... I have a macro that opens a workbook off of my server. I am wanting to be able to display a dialog box that says that the file does not exist and then goto to the end of the macro. As is now I get a runtime error '1004' and you have to end the macro or debug it. I don't want the user to see this error message. Here is the code that opens the workbook: Set destWB = Workbooks.Open("X:\Projects\Group 17 (McLendon)\Group 17 Dayrates\" & wName) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sStr = "X:\Projects\Group 17 (McLendon)\Group 17 Dayrates\"
if Dir(sStr & wName) = "" then msgbox wName & " doesn't exist in " & sStr exit sub End if Set destWB = Workbooks.Open & wName) -- Regards, Tom Ogilvy "Judd Jones" wrote in message ... I have a macro that opens a workbook off of my server. I am wanting to be able to display a dialog box that says that the file does not exist and then goto to the end of the macro. As is now I get a runtime error '1004' and you have to end the macro or debug it. I don't want the user to see this error message. Here is the code that opens the workbook: Set destWB = Workbooks.Open("X:\Projects\Group 17 (McLendon)\Group 17 Dayrates\" & wName) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel looking foe xla file that no longer exist | Excel Discussion (Misc queries) | |||
does a file exist | Excel Discussion (Misc queries) | |||
Does file exist? | Excel Programming | |||
Detecting If An .xls File Exist | Excel Programming | |||
does a file exist? | Excel Programming |