ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   File Exists Formula (https://www.excelbanter.com/excel-worksheet-functions/117991-file-exists-formula.html)

El Bee

File Exists Formula
 
Is there a formula that can ba used in a cell to check if a file exists; if
the file does exists then do .......

In other languages I've used : If fexists(filename) then .....

PCLIVE

File Exists Formula
 
I think I've used something like this before.


If Len(Dir([path and Filename])) _
Then
msgbox ("File already exists!")
end
Else:
<Your code
end if


HTH,
Paul


"El Bee" wrote in message
...
Is there a formula that can ba used in a cell to check if a file exists;
if
the file does exists then do .......

In other languages I've used : If fexists(filename) then .....




PCLIVE

File Exists Formula
 
One note, the pathname should be in quotes unless it will be referenced by a
cell reference or variable.

HTH,
Paul

"PCLIVE" wrote in message
...
I think I've used something like this before.


If Len(Dir([path and Filename])) _
Then
msgbox ("File already exists!")
end
Else:
<Your code
end if


HTH,
Paul


"El Bee" wrote in message
...
Is there a formula that can ba used in a cell to check if a file exists;
if
the file does exists then do .......

In other languages I've used : If fexists(filename) then .....






El Bee

File Exists Formula
 
Paul,

I'm struggling with the syntax.
I have file on Drive L
In the directory called TechnicalServices
Sub directory called "Daily Status Reports" (space between each word)
File name is MyFile110608.xls.

I have tried your syntax and keep getting an error; "That name is invalid"

here' the text of the formula:

=IF LEN(DIR([\\L:\depts\TechnicalServices\Daily Status Report\History\IT
Daily Status 061108.xls]))

I have tried including quotes but I get the same error; where am I going
wrong?

Thanks for your time and help.

Larry

"PCLIVE" wrote:

I think I've used something like this before.


If Len(Dir([path and Filename])) _
Then
msgbox ("File already exists!")
end
Else:
<Your code
end if


HTH,
Paul


"El Bee" wrote in message
...
Is there a formula that can ba used in a cell to check if a file exists;
if
the file does exists then do .......

In other languages I've used : If fexists(filename) then .....





PCLIVE

File Exists Formula
 
Sorry Larry,

I overlooked the fact that you posted this in worksheet functions. The
solution I gave you would be used in a Macro (Visual Basic). I'm not
exactly sure how to do it in a function.
Maybe something like:

=IF(ISERROR('L:\depts\TechnicalServices\Daily Status Report\History\[IT
Daily Status 061108.xls]Sheet1'!$A$1)=TRUE,"File does not exist!","File
already exists!")

There may be another way to better suit your needs, but that's all I could
come up with right now.

HTH,
Paul


"El Bee" wrote in message
...
Paul,

I'm struggling with the syntax.
I have file on Drive L
In the directory called TechnicalServices
Sub directory called "Daily Status Reports" (space between each word)
File name is MyFile110608.xls.

I have tried your syntax and keep getting an error; "That name is invalid"

here' the text of the formula:

=IF LEN(DIR([\\L:\depts\TechnicalServices\Daily Status Report\History\IT
Daily Status 061108.xls]))

I have tried including quotes but I get the same error; where am I going
wrong?

Thanks for your time and help.

Larry

"PCLIVE" wrote:

I think I've used something like this before.


If Len(Dir([path and Filename])) _
Then
msgbox ("File already exists!")
end
Else:
<Your code
end if


HTH,
Paul


"El Bee" wrote in message
...
Is there a formula that can ba used in a cell to check if a file
exists;
if
the file does exists then do .......

In other languages I've used : If fexists(filename) then .....








All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com