Consulting

Results 1 to 6 of 6

Thread: How to control which vba Excel program has control on computer

  1. #1

    How to control which vba Excel program has control on computer

    I have two separate vba Excel programs which interact with each other.

    Right now, whichever program I open first (and enable macros) has control on my computer (even when I programmatically activate a window in the other program).

    There are times I want vba control to be taken by the other program. How do I control which program has control (vba/macro-wise) on my computer?

    Thanks,
    Steve

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Question: two instances of Excel.exe each with one workbook, OR 2 workbooks open in a single instance of Excel.exe?

    Paul

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    I'd say from reading the post Paul, that he's talking about the first.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Quote Originally Posted by Aussiebear
    I'd say from reading the post Paul, that he's talking about the first.
    Just wanted to understand since activating another workbook is very different from activating another instance of Excel.

    We have a guy at work who's (in)famous for have 3 or more Excel instances open with 2 or more workbooks in some of them. He wonders why he has crashes and macro and ribbon disconnects.

    I have two separate vba Excel programs which interact with each other.
    Steve -- can you use one Excel instance, with 2 macro workbooks?

    Paul

  5. #5
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    [vba]
    Dim objThatOtherBook As Workbook
    If Not Workbooks("Other Book's Name") IsNothing Then 'Book is open
    Set objThatOtherBook = Workbooks("Other Book's Name")
    Else 'book is not open
    Exit Sub
    End If

    Call objThatOtherBook.MacroName()
    ' OR
    Call objThatOtherBook.ModuleName.MacroName()
    'where ModuleName is the name of the module the macro is in

    [/vba]

  6. #6
    I have two separate Excel workbooks (both with vba macros).

    - Steve

Posting Permissions

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