Try:
'=============>>
Public Function FileExists(sPath As String, _
Optional sFName As String) As Boolean
FileExists = Len(Dir(sPath & sFName)) > 0
End Function
'<<=============
An example of usage might be:
'=============>>
Sub TestIt()
MsgBox FileExists("C:\MyFolder\", "aBook.xls")
End Sub
'<<=============
@echo off
del /q c:\ok.txt
if exist "LA RUTA DE TU ARCHIVO & NOMBRE DEL MISMO" (
echo "El archivo existe" > c:\ok.txt
) else (
echo "El archivo no existe" > c:\ok.txt )
@echo on
sub existe()
Shell ("c:\existe.bat")
Open "c:\ok.txt" For Input As #1
Do Until EOF(1)
Line Input #1, vartexto
MsgBox vartexto
Loop
Close #1
end sub()
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.