View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default File does not exist


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)