ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dir function (https://www.excelbanter.com/excel-programming/323463-dir-function.html)

Alok[_3_]

Dir function
 
Friends,

I have been using the following function for Checking if the file
exists.

Public Function FileExists(ByVal sPathAndFileName$)as boolean
FileExists = (Dir(sPathAndFileName)<"")
End Function

Today for the first time I found that the function worked if the
filename part passed to the function matched the case of the file
stored in the folder but did not work if the capitalization was not
correct. I beleive that the Dir function is not case sensitive. What is
happening then?

Thanks.

Alok


RB Smissaert

Dir function
 
What was the exact full path of that file?

RBS


"Alok" wrote in message
oups.com...
Friends,

I have been using the following function for Checking if the file
exists.

Public Function FileExists(ByVal sPathAndFileName$)as boolean
FileExists = (Dir(sPathAndFileName)<"")
End Function

Today for the first time I found that the function worked if the
filename part passed to the function matched the case of the file
stored in the folder but did not work if the capitalization was not
correct. I beleive that the Dir function is not case sensitive. What is
happening then?

Thanks.

Alok



Alok[_3_]

Dir function
 
The file path and file name was
Z:\CMI\CMGWorksheet\MasterProtocolMultiV6.xls
As I am writing this I am thinking whether it had something to do with
drive mapping?
Alok


RB Smissaert wrote:
What was the exact full path of that file?

RBS


"Alok" wrote in message
oups.com...
Friends,

I have been using the following function for Checking if the file
exists.

Public Function FileExists(ByVal sPathAndFileName$)as boolean
FileExists = (Dir(sPathAndFileName)<"")
End Function

Today for the first time I found that the function worked if the
filename part passed to the function matched the case of the file
stored in the folder but did not work if the capitalization was not
correct. I beleive that the Dir function is not case sensitive.

What is
happening then?

Thanks.

Alok




All times are GMT +1. The time now is 02:52 AM.

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