View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
mudraker[_107_] mudraker[_107_] is offline
external usenet poster
 
Posts: 1
Default check for valid file

Use DIR command

Several examples

===============
sPath$ = ThisWorkbook.Path & "\Data"
sFname$ = "Data.xls"
sFile$ = sPath & "\" & sFname

If Dir(sPath, vbDirectory) = "" Then
MkDir (sPath)
End If


===============
If Dir(sFile) = "" Then
Exit Sub
End If

===================

sDir = Dir(sPath & "\*.*")
Do
If sDir = "" Then
Exit Do
End If
more code here
sDir = Dir ' gets the next file
Loo

--
Message posted from http://www.ExcelForum.com