View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gary Brown[_4_] Gary Brown[_4_] is offline
external usenet poster
 
Posts: 209
Default checking if a sheet exists

That is the best way as far as I can see....
'/===============================/
Public Function FileExists(strFileName As String) _
As Boolean
FileExists = False
If Dir(strFileName) < "" Then
FileExists = True
End If
End Function
'/===============================/

--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown


"greg" wrote:

Is there a good way of checking if a sheet exists?
Besides doing this
excel.ActiveWorkbook.Sheets("foo").name
and catching the error that is thrown.