Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default File Checking

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

--



  #2   Report Post  
Posted to microsoft.public.excel.programming
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

--





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default File Checking

Thank you chip.

Excellent - almost a one-liner!

Thanks and regards,
Don

--

"Chip Pearson" wrote in message
...
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

--







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File integrity checking? bogstick Excel Discussion (Misc queries) 24 April 30th 14 10:50 PM
Checking to see if a file exists. JHB Excel Discussion (Misc queries) 3 August 5th 09 03:11 PM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
file size & error checking runaero Excel Discussion (Misc queries) 3 September 26th 06 07:40 PM
Add checking Pat Excel Worksheet Functions 5 December 17th 04 08:25 PM


All times are GMT +1. The time now is 03:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"