Map a Network Drive

G

George

In retrospect, I should have asked first.

I wrote a function in VBA to which one passes a desired
share path. If the share is not yet mapped, the function
identifies the next available network drive letter and
maps the share to that drive; the function returns the
drive letter of the mapped share.

Here's the issue:
I did not know how to actually map the drive in VBA
Access, so I wrote a little WSH script (see below).
How should I have done it in Access?

Thanks for your help
George

'--------
Set WshNetwork = WScript.CreateObject("WScript.Network")

strArguments = wscript.Arguments.Item(0)
intComma = Instr(strArguments, ",")
strDriveLetter = Left(strArguments,intComma-1)
strShare = Trim(Mid(strArguments, intComma+1,Len
(strArguments)-intComma))

WshNetwork.MapNetworkDrive strDriveLetter, strShare
'--------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top