Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 '----------------------- "Raj" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Links broken - UNC vs drive mapping | Links and Linking in Excel | |||
Saving to a netword folder without mapping drive | Excel Programming | |||
Link workbooks-C drive to network drive | Excel Worksheet Functions | |||
Userform Local Drive & Network drive question | Excel Programming | |||
Mapping a drive through a macro | Excel Programming |