Consulting

Results 1 to 7 of 7

Thread: Activate a non-Excel Window

  1. #1

    Smile Activate a non-Excel Window

    Hi everyone.
    I'm working on an Excel sheet and one feature I would really need is for it to activate an external window (not Microsoft).
    Is this even possible using VBA? Has anyone else had this need?

    Thanks in advance.

  2. #2
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    568
    Location
    See if this works :

    Sub RunAnExe()
    Dim strX As String, varProc As Variant
    
    On Error Resume Next
    
    strX = "C:\Users\YourComputerNameHere\SomeOther.exe" 'Your path here
    
    varProc = Shell(strX, 1)
    
    End Sub

  3. #3
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    568
    Location
    Or maybe this :

    Sub OpenConvertMe()
        Dim RetVal
        RetVal = Shell("C:\WINDOWS\Convert.EXE", 1)
    End Sub
    C:\WINDOWS\Convert.EXE" should be the full name and path to the program you want to open.

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,393
    Location
    Quote Originally Posted by PinkyCyclops View Post
    Hi everyone.
    I'm working on an Excel sheet and one feature I would really need is for it to activate an external window (not Microsoft).
    Is this even possible using VBA? Has anyone else had this need?

    Thanks in advance.
    Is the other program already running and you just want to switch to its window, OR do you want to start the second program?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    Quote Originally Posted by Paul_Hossler View Post
    Is the other program already running and you just want to switch to its window, OR do you want to start the second program?
    Hi Paul
    The other program is already running. Therein, lies the rub.

  6. #6
    VBAX Expert
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    814
    Location
    I just got the below to bring my Amazon Music app to the front:
    Sub test()    
        AppActivate ("Amazon Music")
    End Sub
    If things don't change they stay the same
    Quite often there is a picnic problem (problem in chair not in computer)
    "We were not told it was impossible, so we did it."

  7. #7
    Quote Originally Posted by georgiboy View Post
    I just got the below to bring my Amazon Music app to the front:
    Sub test()    
        AppActivate ("Amazon Music")
    End Sub

    That is excellent - mission accomplished!!
    Thanks everyone!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •