Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dir functio not working

5 views
Skip to first unread message

Jack

unread,
Nov 20, 2009, 11:35:03 AM11/20/09
to
Hi,
I have implented the dir function in a program. It has file content. However
when I am stepping through the code the Dir function does not give
any result which it should.

Where should I look for to resolve this. I appreciate any
help for resolution. Thanks.

NeilH

unread,
Nov 20, 2009, 12:05:17 PM11/20/09
to

"Jack" <Ja...@discussions.microsoft.com> wrote in message
news:9E44A82E-BF5A-4879...@microsoft.com...

Sorry but the crystal ball has failed!!

You need to provide the code that you are using.


Jack

unread,
Nov 20, 2009, 12:47:01 PM11/20/09
to
Sorry about that. The following is the code:

strSourceFileName = "c:\CarLogOutPut\CarLogExportTemplate.xls"
WorkBookName = "c:\CarLogOutPut\CarLogExport.xls"

If Dir(strSourceFileName) = "" Then
MsgBox "CarLogExportTemplate.xls does not exist. It must exist for
processing", vbInformation, "File does not exist"
Exit Sub
End If

The line Dir(strSourceFileName) is where the error is coming:
The error number is Run time error 52: Bad file name or number

I am not sure if this is a permission
issue or something else. However the Dir function
is the one which is not working here.
Thanks.


"NeilH" wrote:

> .
>

Dee Earley

unread,
Nov 23, 2009, 7:04:34 AM11/23/09
to
On 20/11/2009 17:47, Jack wrote:
> Sorry about that. The following is the code:
>
> strSourceFileName = "c:\CarLogOutPut\CarLogExportTemplate.xls"
> WorkBookName = "c:\CarLogOutPut\CarLogExport.xls"
>
> If Dir(strSourceFileName) = "" Then
> MsgBox "CarLogExportTemplate.xls does not exist. It must exist for
> processing", vbInformation, "File does not exist"
> Exit Sub
> End If
>
>
>
> The line Dir(strSourceFileName) is where the error is coming:
> The error number is Run time error 52: Bad file name or number
>
> I am not sure if this is a permission
> issue or something else. However the Dir function
> is the one which is not working here.
> Thanks.

In inaccessible folder will generate this error.
Note that not existing doesn't count.

In this case, I used a non existent drive, but I believe permissions
will do the same.

--
Dee Earley (dee.e...@icode.co.uk)
i-Catcher Development Team

iCode Systems

0 new messages