ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Path and File (https://www.excelbanter.com/excel-programming/424102-path-file.html)

Heera[_2_]

Path and File
 
Hi,

1 Problem : I have a share drive in my company but some times it is
accessable and some times it is not accessable due to some technical reason.

If the share drive is not accessable I get an error can anyone tell me how
to handel this error exit the macro.

2 Problem : How can I come to know if a particular file is available on a
particular path.

3. Problem : How can I come to know if a particular path is available on a
computer.

Regards
Heera
Regards
Heera

Gary''s Student

Path and File
 
Use DIR:

If Dir(filespec) = "" Then
do something else
End If

--
Gary''s Student - gsnu200833


"Heera" wrote:

Hi,

1 Problem : I have a share drive in my company but some times it is
accessable and some times it is not accessable due to some technical reason.

If the share drive is not accessable I get an error can anyone tell me how
to handel this error exit the macro.

2 Problem : How can I come to know if a particular file is available on a
particular path.

3. Problem : How can I come to know if a particular path is available on a
computer.

Regards
Heera
Regards
Heera


[email protected]

Path and File
 
On Feb 13, 10:00*pm, Heera wrote:
Hi,

1 Problem : I have a share drive in my company but some times it is
accessable and some times it is not accessable due to some technical reason.

If the share drive is not accessable I get an error can anyone tell me how
to handel this error exit the macro.

2 Problem : How can I come to know if a particular file is available on a
particular path.

3. Problem : *How can I come to know if a particular path is available on a
computer.

Regards
Heera
Regards
Heera


You can use the DIR function.

MyPath="\\server\xyz\abc.xls"
StrReturn=dir(MyPath)
if StrReturn="" then
msgbox "The path is not availableor the file is not there"
end if

Heera[_2_]

Path and File
 
Both the solutions were usefull.

Thank you........

Heera[_2_]

Path and File
 
Gary can you answer my first problem.

when I dissconnect the cable of network and try to run the macor I get an
error.

It say bad file name error 52. How do i handle this error.
Regards
Heera


All times are GMT +1. The time now is 01:36 AM.

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