View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_2_] Harald Staff[_2_] is offline
external usenet poster
 
Posts: 449
Default Checking if a workbook exists

Sub test()
If Dir("C:\Stuff\toto.xlsx") = "" Then
MsgBox "Get outta here", vbInformation
Exit Sub
End If
'meaningful code goes here
End Sub

HTH. Best wishes Harald


"Pierre Leclerc" wrote in message
news:1218490.933.1320017545974.JavaMail.geo-discussion-forums@yqgn17...
Before I do workbooks.open "toto.xlsx" I want to check if such workbook
really exist on my disk.

How do I go about doing this?