ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File exists under directory (https://www.excelbanter.com/excel-programming/348261-file-exists-under-directory.html)

Jim Thomlinson[_4_]

File exists under directory
 
This will work for you assumimng you meant the windows directory and not all
subdirectories. Place it in a standard code module...

Public Function FileExists(ByVal FileName As String) As Boolean
FileExists = CBool(Len(Dir("C:\Windows\" & FileName)))
End Function

--
HTH...

Jim Thomlinson


"PeterW" wrote:


Hi

I am trying to put together a report in excel that shows whether or not
certain files exist under the windows directory.

By concatenating a number of fields I produce the name of the file I
would like to check if it exists. If it exists I want the cell to
return TRUE and if not FALSE.

I think I will need a UDF to do this as I want to copy the formula to
other cells that are concatenating other filenames to check.

Any help would be appreciated.

Peter


--
PeterW
------------------------------------------------------------------------
PeterW's Profile: http://www.excelforum.com/member.php...fo&userid=6496
View this thread: http://www.excelforum.com/showthread...hreadid=493988



PeterW[_10_]

File exists under directory
 

Hi

I am trying to put together a report in excel that shows whether or no
certain files exist under the windows directory.

By concatenating a number of fields I produce the name of the file
would like to check if it exists. If it exists I want the cell t
return TRUE and if not FALSE.

I think I will need a UDF to do this as I want to copy the formula t
other cells that are concatenating other filenames to check.

Any help would be appreciated.

Pete

--
Peter
-----------------------------------------------------------------------
PeterW's Profile: http://www.excelforum.com/member.php...nfo&userid=649
View this thread: http://www.excelforum.com/showthread.php?threadid=49398


PeterW[_11_]

File exists under directory
 

Thanks Jim .. that works


--
PeterW
------------------------------------------------------------------------
PeterW's Profile: http://www.excelforum.com/member.php...fo&userid=6496
View this thread: http://www.excelforum.com/showthread...hreadid=493988



All times are GMT +1. The time now is 08:53 AM.

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