Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Raj Raj is offline
external usenet poster
 
Posts: 130
Default How to get network drive mapping

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default How to get network drive mapping

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Links broken - UNC vs drive mapping heathy Links and Linking in Excel 5 December 16th 05 09:52 AM
Saving to a netword folder without mapping drive JNW Excel Programming 3 August 24th 05 03:37 PM
Link workbooks-C drive to network drive Earl Excel Worksheet Functions 0 April 19th 05 05:50 PM
Userform Local Drive & Network drive question Joel Mills Excel Programming 3 December 29th 04 10:43 PM
Mapping a drive through a macro Marino13[_4_] Excel Programming 1 January 12th 04 10:54 PM


All times are GMT +1. The time now is 02:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"