Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am looking for a way to map a network drive with a macro when a user
opens a spreadsheet. Then when the user is done using the spreadsheet, another macro would disconnect the mapped drive. Does anyone know of a way to accomplish this? Any help would be appreciated. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Have the workbook open event macro call something like this:
Sub mapp_um() dq = Chr(34) s = "net use z: /delete /y" ss = "net use z: " & dq & "\\myServ\Shared" & dq & " /PERSISTENT:no" x = Shell("cmd.exe /c" & s, 1) x = Shell("cmd.exe /c" & ss, 1) End Sub In this example I used Z: as the drive. The initial delete is just in case Z: is already being used. Trap the workbook close event and have it call something like: Sub unmap() dq = Chr(34) s = "net use z: /delete /y" x = Shell("cmd.exe /c" & s, 1) End Sub This releases Z: -- Gary''s Student - gsnu200727 " wrote: I am looking for a way to map a network drive with a macro when a user opens a spreadsheet. Then when the user is done using the spreadsheet, another macro would disconnect the mapped drive. Does anyone know of a way to accomplish this? Any help would be appreciated. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Just curious why you have to map that drive. I would think that most things
(all things???) would work ok if you used the UNC path. wrote: I am looking for a way to map a network drive with a macro when a user opens a spreadsheet. Then when the user is done using the spreadsheet, another macro would disconnect the mapped drive. Does anyone know of a way to accomplish this? Any help would be appreciated. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I need a macro that saves a spreadsheet on two drive at once, | Excel Worksheet Functions | |||
Can I save to hard drive AND my flash drive at the same time? | Excel Discussion (Misc queries) | |||
Macro drive problem | Excel Discussion (Misc queries) | |||
Macro in excel to save to an unmapped drive ! | Excel Discussion (Misc queries) | |||
Multi-user macro on network drive? | Excel Discussion (Misc queries) |