Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

How to get network drive mapping

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raj - 25 Jan 2006 00:10 GMT
Hi

In an excel macro, I  need to list all the drives available to a user and if
the drive is a network drive, then I need to list its mapping string eg
\\finance\restructre

Please can some one help, thanks in advance
Jim Cone - 25 Jan 2006 00:58 GMT
Raj,

This ought to get you close.
I am not on a network so I cannot determine how a network drive is listed.
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

'-----------------------------------
Private Sub GetAllDrives()
'Jim Cone - San Francisco, USA - January 2006
'Requires project reference to "Microsoft Scripting Runtime"
'Lists all drives and their types on the active sheet.
 On Error GoTo Start_Error
 Dim FSO          As Scripting.FileSystemObject
 Dim objAllDrives As Scripting.Drives
 Dim objDrive     As Scripting.Drive
 Dim strLetter    As String
 Dim strType      As String
 Dim varTypes     As Variant
 Dim lngCount     As Long
 Dim lngRow       As Long
 
 Set FSO = New Scripting.FileSystemObject
 Set objAllDrives = FSO.Drives
'Other in case a 'type' is added in the future.
 varTypes = Array("  Unknown", "  Removable", "  Hard Drive", _
            "  Network", "  CD/DVD", "  RAM Disk", "  Other")
 lngRow = 1
 For Each objDrive In objAllDrives
        lngRow = lngRow + 1
        strLetter = objDrive.Path
        lngCount = objDrive.DriveType
        strType = varTypes(lngCount)
        Cells(lngRow, 2).Value = strLetter & strType
 Next
 
 Set objDrive = Nothing
 Set objAllDrives = Nothing
 Set FSO = Nothing
 Exit Sub
 
Start_Error:
 Beep
 Resume Next
End Sub
'-----------------------

Hi
In an excel macro, I  need to list all the drives available to a user and if
the drive is a network drive, then I need to list its mapping string eg
\\finance\restructre

Please can some one help, thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.