ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If A Directory Exists (https://www.excelbanter.com/excel-programming/352401-re-if-directory-exists.html)

Jim Thomlinson[_5_]

If A Directory Exists
 
Instead of using the drive letter why not jsut use the complete drive
mapping, something like...

Workbooks.Open ("\\myServer\myDirectory\Statements\netcap.xls" )

You can ge the \\myserver\mydirectory from lookin in Windows explorer at the
drive mapping next to the drive letter.
--
HTH...

Jim Thomlinson


"achidsey" wrote:

Excel Experts,

My code needs to open a file in a network directory named "Statements".

For me, Statements is under my "T:" drive, but for other users, it's
somewhere else.

I generally run this code, so I don't want to ask for a drive letter every
time. What I want my code to do is ask, "is the directory "T:\Statements"
available?"

If the code is running on my machine, the above question will generate Yes
and the code will continue to the Then branch.

If someone else whose Statements folder is under another drive letter, the
question will generate No, and my code will go to the Else branch.

My code will be something like:

If T:\Statements Exists Then

Workbooks.Open ("T:\Statements\netcap.xls")

Else

Letter = InputBox("Enter the Drive Letter for the Statements folder")

Workbooks.Open(Letter & ":\Statements\netcap.xls")

End If

My question is, How do I ask "If T:\Statements exists"?

Thanks,
Alan


--
achidsey



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

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