View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default ActiveX Control Combo Box

The code below requires a reference to the MS WMI Scripting Library

HTH,
Bernie
MS Excel MVP


Sub IdentifyDrives()
Dim colDisks As SWbemObjectSet
Dim objDisk As SWbemObject
Dim myDisks() As String
Dim i As Integer

Set colDisks = GetObject( _
"Winmgmts:").ExecQuery("Select * from Win32_LogicalDisk")
i = 0
ReDim myDisks(1 To colDisks.Count)
For Each objDisk In colDisks
i = i + 1
myDisks(i) = objDisk.DeviceID
Next objDisk
For i = 1 To UBound(myDisks)
MsgBox "Drive #" & i & " is " & myDisks(i)
Next i

End Sub
"K" wrote in message
...
Hi all, I have ActiveX Control Combo Box on my sheet. Is there any
way or macro that when I click that Combo Box drop down button then it
show me all the drives list on computer in Combo Box List index Like
( "C:\" , "D:\" , "E:\" etc) or is there any other control in which i
can achive this. Please note i dont need dialog box popping up to see
the list of drives i just want this list to appear (preferable Comb
Box) in control on sheet. Please can any friend can help.