Map Network Drive using different credentials

crafty42

New Member
Joined
Oct 18, 2015
Messages
6
I need to map a network drive that I'm given access to with a username/password to get into the subfolders and copy files over to my local PC. I've been working on code using several options, but to no avail. The one method I did get to work was using cmd.exe and "net use...." which maps the drive, but doesn't seem to pass the credentials on to the subfolders which I can't get in to.

The long way to map it, if it helps, is to right click "this pc", select map network drive, put in the "\\IPAddress\foldername", check the box to "Connect using different credentials" Click finish. On the next popup I need to click "More Choices" and select "Use a different account" (otherwise it tries to use my current network credentials). Then I put in the domain/username and my temporary password.

I'm trying to develop a vba macro that can do this all for me just by putting in the username and password on a form. Any assistance would be appreciated.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Oh crap. I can't seem to edit my post, maybe I'm still too new. I just manually mapped the drive and it still won't let me in the subfolders, so maybe it isn't my code that's the problem.

I'd still take opinions on the best way to code the mapping other than "net use"
 
Upvote 0

Forum statistics

Threads
1,215,497
Messages
6,125,155
Members
449,208
Latest member
emmac

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top