How to Connect a network Drive
Hi Alain
---If you are looking to Get the folder object you dont need to map that as
a drive..Instead you can directly mention the UNC Path as below
Dim fso As Object, objFolder As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder("\\server\share folder")
MsgBox objFolder.Name
---If you are looking to map this folder as a network drive then try the below
Dim objWSNet As Object, strDrive As String, strUNCPath As String
Set objWSNet = CreateObject("WScript.Network")
strDrive = "Z:"
strUNCPath = "\\server\share folder"
objWSNet.MapNetworkDrive strDrive, strUNCPath
--
Jacob
"Alain-79" wrote:
Using fso, I need to be able to make a getFolder on several possible path
including Network Drives... but when one of them is not connected I get an
error...
It's rather simple to open the explorer and to click on this network drive
in order toget it connected... but how can I automate this through vba code...
In other words: How can I through vba connect an existing network drive and
this even if I have just the logical path such as Z:\Folder
Using <<Net Use would imply I have kept the network path such as
\\server\...\shared folder or at least that I am capable of recovering it...
Thanks for any potential help...
Regards
Alain
|