Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding with WMI?

Status
Not open for further replies.

Smithsco

Technical User
Mar 30, 2003
89
AU
When I create a VB 6 app like

Private Sub Form_Load()
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process",,48)
For Each objItem in colItems
msgbox "Name: " & objItem.Name
Next
end sub

It work fine, however if I add option explicit I get an error, do you know what I should be dim objwmiservice/colitems/objitem as?
 
Dim strComputer As String
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top