ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Verify if filename is valid (https://www.excelbanter.com/excel-programming/351716-verify-if-filename-valid.html)

Alex St-Pierre

Verify if filename is valid
 
Hi,
I need to say if a specific path refer to a valid file. It tried to use the
function below but it give true if the directory is valid.
ex:
myFileName = "C:\Temp" should answer false (all the time)
myFileName = "C:\Temp\Test.xls" should answer true (if file exist)

I tried that but doesn't work.
Len(Dir$((myFileName,vbdirectory)
Len(myFileName)
CBool(Len(Dir(myFileName)))

Thanks
--
Alex St-Pierre


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

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