ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   map network drive (https://www.excelbanter.com/excel-programming/412116-map-network-drive.html)

lumpy04

map network drive
 
Hello,

I would like to map a network drive when I open the worksheet. Something Like

Private Sub worksheet_open()
Net use y: \\server\share password /user ID
end sub

Can anyone help?

Gary''s Student

map network drive
 
Something like:

Sub map_um()
dq = Chr(34)
s = "net use z: /delete /y"
ss = "net use z: " & dq & "\\MAINSERVER\Shared" & dq & " /PERSISTENT:no"
x = Shell("cmd.exe /c" & s, 1)
x = Shell("cmd.exe /c" & ss, 1)
End Sub

Note I use the variable dq as I always have trouble embedding double quotes
in a string.
--
Gary''s Student - gsnu200790


"lumpy04" wrote:

Hello,

I would like to map a network drive when I open the worksheet. Something Like

Private Sub worksheet_open()
Net use y: \\server\share password /user ID
end sub

Can anyone help?



All times are GMT +1. The time now is 10:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com