Thread: File Checking
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default File Checking

Donald,

Use the Dir function to determine if the file exists. E.g.,


Dim FName As String
FName = InputBox("Enter a file name")
If FName < "" Then
If Dir(FName) < "" Then
MsgBox "File Exists"
Else
MsgBox "File does not exist"
End If
Else
MsgBox "You didn't enter a file name"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Donald Lloyd" wrote in message
...
Hi,

My thanks to Chip Pearson and Bob Phillips for their informed

replies to my
recent query re worksheet tabs - they made life a lot easier.

Another, if you don't mind.

I wish to check the current directory for the existence of an

user entered
filename.
What's the simplest way of doing thias - I would rather not

invoke the
SaveAs dialog box.

regards,
Don Lloyd

--