I have a function that uses File System Object to get the actual network name of a drive. Today, a remote user had it crash when I tried to return the Sharename.
Code:
Specifically, it fails on "strShare = objfso.Drives(strDrive).ShareName" line.
The incoming LocalPath variable is "P:\GroundwaterDatabases\GWIDS\ImageLocationMap\Gl ennCounty_Book3\21N04W12A002M_LocationMap.jpg"
I want to change LocalPath to \\nasnro\Projects (i.e., replacing the LocalPath (P) with the network path (\\nasnro\projects).
Any idea why it doesn't work? It's been doing fine for months on other computers.
Thanks for any help you can provide!
Jonathan Mulder
Engineering Geologist
California Department of Water Resources
Code:
Code:
Function GetUNC(LocalPath As String) As StringMsgBox ("GetUNC Function")Dim objFso As FileSystemObjectSet objFso = New FileSystemObjectDim strDrive As StringDim strShare As StringstrDrive = objFso.GetDriveName(LocalPath)strShare = objFso.Drives(strDrive).ShareNameGetUNC = Replace(LocalPath, strDrive, strShare)Set objFso = NothingEnd Function
The incoming LocalPath variable is "P:\GroundwaterDatabases\GWIDS\ImageLocationMap\Gl ennCounty_Book3\21N04W12A002M_LocationMap.jpg"
I want to change LocalPath to \\nasnro\Projects (i.e., replacing the LocalPath (P) with the network path (\\nasnro\projects).
Any idea why it doesn't work? It's been doing fine for months on other computers.
Thanks for any help you can provide!
Jonathan Mulder
Engineering Geologist
California Department of Water Resources