Here's the code that I got to get Installed applications in any PC (Window 7). This thing once worked on my side but when I execute it again I'm getting run time error '-2147217392 (80041010) - Automation Error. Anyone can help me? Thanks..
![]()
Sub test2() x = 2 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSoftware = objWMIService.ExecQuery("Select * from Win32reg_AddRemovePrograms64") For Each objSoftware In colSoftware '--> in this line the error comes up. ActiveWorkbook.Sheets("Sheet1").Cells(x, 4).Value = objSoftware.DisplayName 'needed ActiveWorkbook.Sheets("Sheet1").Cells(x, 5).Value = objSoftware.Version x = x + 1 Next End Sub
Bookmarks