VBA: list of open applications

Stach -  
 Anonymous user -
Bonjour,

Could someone provide me with the VBA code to list the names of all my running applications and windows?

I tried:

For Each Window in Windows
Debug.print Window.Name
Next

The only problem is that it only gives me the names of the open Excel windows and not those of other programs (Word, new Outlook email, etc.)

Thank you in advance.

Stach ;-)
Configuration: Windows XP Internet Explorer 7.0

6 answers

  1. Anonymous user
     
    already asked as a question
    --
    QUIKYLAND (add by Google) -- Do enjoy yourself!

    Be French, buy French -- Be French, buy French
    0
    1. Stach
       
      Super response!

      Where can I find the solution to my problem please? Do you have a link to the answer to this question already asked that you could propose?

      Thanks in advance.

      Stach ;-)
      0
    2. Stach2
       
      You are useless, seriously.
      0
  2. Anonymous user
     
    Hello,

    You can use scripting objects; however, with this method
    you will need to differentiate between "processes" and applications.

     Dim objWsProcess, objProc, Network, msgText Set Network = CreateObject("WScript.Network") Computer = LCase(Network.ComputerName) Set objWsProcess = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & _ Computer).InstancesOf("Win32_Process") For Each objProc in objWsProcess If ( ( CmptPtr - 1 ) < 10 ) Then msgText = msgText & "Ptr 0" & (CmptPtr - 1) & " = " & objProc.Name & vbCrLf Else msgText = msgText & "Ptr " & (CmptPtr - 1) & " = " & objProc.Name & vbCrLf End if Next Set objWsProcess = Nothing Set objProc = Nothing WScript.Echo msgText WScript.Quit(0) 


    Regards

    Lupin
    0
  3. DMike92
     
    @Lupin :
    Hello and thank you for this post which helps me a lot.
    How is the variable CmptPtr initialized?
    0
  4. Anonymous user
     
    Hello,

    CmptPtr = 1

    For each ...

    This variable is only used to form a homogeneous label

    ...
    Ptr08
    Ptr09
    Ptr10
    Ptr11
    ...

    If you want to perform a manipulation of the PtrXY variable
    it always contains the same number of characters.

    Cdt

    Lupin
    0
  5. Dmike92
     
    Hello,
    If I understand correctly, there should be a CmptPtr = CmptPtr + 1 somewhere... in the loop.

    And I thought I saw elsewhere that we can even (to keep it simple) replace:

    Set Reseau = CreateObject("WScript.Network")
    Ordinateur = LCase(Reseau.ComputerName)

    with:

    Ordinateur = "."
    Of course, it's less generic. But it works locally.

    Thanks anyway :-)
    0
  6. Anonymous user
     
    re:

    Indeed, that's correct for the variable CmptPtr ...

    It is missing its incrementation as well as initialization.

    I must have placed this code a bit too quickly, I apologize for that.

    Indeed, the character [ . ] works locally,
    but I tend to be explicit and not knowing what the specific needs of the requester were ...

    Nobody's perfect :-)

    Best regards

    Lupin
    0