Determining Which Office Program is "Active" RRS feed

  • Question

  • I want to share some coding that will run differently if the screen is showing Access or Word 2010.  Obviously, I will need to have VBA tell which program is on the screen. How is this done?
    • Moved by Mark Liu-lxfModerator Wednesday, December 7, 2011 3:17 AM VBA question (From:Visual Basic General)
    Tuesday, December 6, 2011 12:16 AM


All replies

  • code.

    This is not a vba forum although VBA is not necessary.


    "MODERN PROGRAMMING is deficient in elementary ways BECAUSE of problems INTRODUCED by MODERN PROGRAMMING." Me

    Tuesday, December 6, 2011 1:03 AM
  • You need VBA coding that is different If Access or Word is "showing" ?

    what is "showing" ? - running and on top ? What is access and word are running both minimized ?

    If you need VB help this is the right place, for VBA use


    Tuesday, December 6, 2011 1:11 AM
  • That makes sense to me, I'll wait for a reply from the OP just to be sure. What if both are running and Notepad is the currently active focused app ? I don't think there is any simple way to get a history of what apps were active.



    Tuesday, December 6, 2011 5:06 PM
  • Hi LA lawyer,

    Welcome to the MSDN forum.

    This queue is about Visual Basic in Visual Basic.Net. I’m afraid that your topic about VBA is unsuitable here. For better support, I will move this thread to Visual Basic for Applications (VBA) forum.

    Sorry for any inconvenient and have a nice day.

    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, December 7, 2011 3:15 AM
  • Maybe you are looking for something, that determine the Active Window?

    If so, you might check below thread:



    If not please explain a bit more what you mean which program is on the screen.


    Hope this helps,

    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Thursday, December 8, 2011 3:18 AM