Thread: Existing file ?
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ceemo[_32_] ceemo[_32_] is offline
external usenet poster
 
Posts: 1
Default Existing file ?


This works great but if i am pointing to th a: drive and there isnt
floppy in it the macro will fall over. Is there anyway arond this?




Sub test()
Dim bGotIt As Boolean
Dim sFile As String
Dim sPath As String

sFile = "Book1.xls"
sPath = "c:\temp\"

'On Error Resume Next
bGotIt = (LCase(sFile) = LCase(Dir(sPath & sFile)))
'On Error GoTo 0

MsgBox bGotIt

End Su

--
ceem
-----------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...fo&userid=1065
View this thread: http://www.excelforum.com/showthread.php?threadid=40039