View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Shared folder changed path - sometimes S://SharedFolder sometimes T://SharedFolder

Charlotte E. laid this down on his screen :
While I totally agree with Garry's answer, you could also let the VBA search
for the path, if using a drive-letter, for some reason, is needed.

Something like:

For Counter = Asc("D") to Asc("Z")
If Dir(Chr(Counter)&":\Sharefolder") < "" then DriveLetter =
Chr(Counter)
Next

(Just made from back of my head - not tested)

CE


Den 29.01.2012 00:35, Jan T skrev:
I want to connect to a database file on a shared network folder from
Excel using either DAO or ADO.

My experience, is that some user could not connect sometimes because
their system changed the path like: - sometimes mappping like;
S://SharedFolder
sometimes T://SharedFolder?

How can I avoid missing the path to the db I want to connect to from
Excel using vba?

Thank you for any help!

Regards Jan T.


Charlotte,
That's a good suggestion for finding a specific folder on a local
drive!

<FYI
What I've learned is that VB[A] can't work with 'mapped' drives on a
network because those are for use by the system only. What the system
does is to create a 'virtual namespace' as a 'pointer' to the actual
location on the network. In this case it's been easier to prompt the
user via the folder picker dialog when the stored path throws an error.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc