是否可以列出debug.print中的所有打开的应用程序?
我尝试了以下不起作用的代码。
Dim app As Application
For Each app In Windows.Applications
Debug.Print app.Name
Next app
答案 0 :(得分:3)
尝试这样的事情。
Dim strComputer As String
Dim objWMIService As Variant
Dim colItems As Variant
Dim objItem As Variant
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process", , 48)
For Each objItem In colItems
Debug.Print objItem.ProcessId & " " & objItem.Name & " " & objItem.Caption & " " & objItem.CommandLine & " " & objItem.ExecutablePath
Next