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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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