View Full Version : VB / Excel question
MagooUK
12-09-2001, 05:05 PM
Not really a problem a such, more a quiz question the answer to which eludes me...
I am wanting to write an Excel macro, part of which needs me to map a drive, and run a document from there. Problem is, the macro won't record my mapping of the drive.
Does anybody know the VB command, ie equivalent of running a 'net use' from the command prompt ?
Cheers for any info
Ghost_Hacker
12-10-2001, 11:07 AM
Not sure about VB but in VBscript the method is "mapnetworkdrive"
Example:
Set net = wscript.createobject ("wscript.network")
net.mapnetworkdrive "z:", "\\servername\share"
The linked site below can proably help you more than I can.
http://www.codeguru.com/vb/index.shtml
MagooUK
12-13-2001, 01:01 PM
Tried that last tip, Ghost_Hacker, thanks for the try, but it didn't like the code there.
Also tried at the supplied address, but couldn't find what I needed. Sorry to bleat on, but does anyone have any more ideas on this ? Seems like it should be quite easy, but just can't put my finger on it ...
Ghost_Hacker
12-13-2001, 04:07 PM
Try here:
http://msdn.microsoft.com/library/en-us/wnet/networks_2kmr.asp?frame=true
And here for examples:
http://www.vb-world.net/tips/tip93.html
http://www.unisyn.com/Automate/user/Learning/BASIC/VBA_Scripts/netsys02.html
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q210219
Good luck http://www.PCGuide.com/ubb/smile.gif
[This message has been edited by Ghost_Hacker (edited 12-13-2001).]
vBulletin v3.6.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.