Can a formula check for existance of a file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create a formula that checks to see if the file exists.

What I am doing:
The formula would assemble a file name from data in other cells. (can do this)
The formula would then check to see if the file exists. (can not do this now)
If the file does exists, it will display a button that the user could press
to display the file. (can do this now).

Many thanks for the assistance.
 
I would like a formula, because that is how I thought it best to be done.
Perhaps a macro could accomplish the same thing?
 
Hi again,

I looked at the referenced article, but since I don't have the context of
what the mentioned Lotus 123 function isfile does, it is difficult for me to
understand what the described user fuction is doing - I don't understand the
parameters coming into it.

All I really want to do is pass the user defined function a filename and it
pass back wheather it exists or not.

... Scott
 
I found a solution that works.

As suggested I created a user function in VB. I created an object based on
of system file class and used it to see if user entered filed exists:

Function checkfile(CheckFileName)
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(CheckFileName) Then
checkfile = 1
Else
checkfile = 0
End If
End Function

Thanks to all for pointing me in the right direction.
 
BigWoof wrote...
...
I looked at the referenced article, but since I don't have the
context of what the mentioned Lotus 123 function isfile does, it
is difficult for me to understand what the described user fuction
is doing - I don't understand the parameters coming into it.
...

Sorry. You pass the *full* pathname of the file as the first argumen
to the IsFile udf. The second argument determines whether your checkin
if the file is open in memory or checking that it exists on disk. Zer
or omitted means checking whether it's open in memory. One mean
checking for it on disk. The udf returns 1 if it finds the file, 0 i
it doesn't.

So, to check if C:\foo\bar.xls is open, use

=ISFILE("C:\foo\bar.xls") or =ISFILE("C:\foo\bar.xls",0)

To check if X:\work\budget.xls exists on disk, use

=ISFILE("X:\work\budget.xls",1
 
Back
Top