+ Reply to Thread
Results 1 to 18 of 18

open a new Excel instance from a macro?

  1. #1
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    open a new Excel instance from a macro?

    Hi Everyone,

    Would you know how to open a workbook in another excel instance.
    I need to run 2 things side by side. At the moment, I manually do it, but wonder if I could put that in my code.

    any idea, could be useful!

    Thankfully,
    -Phil

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: open a new Excel instance from a macro?

    You can use:
    Please Login or Register  to view this content.
    for example.
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: open a new Excel instance from a macro?

    thanks Romperstomper,

    I'll try that as soon as I finish running my current macro.

    Thanks again.

  4. #4
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: open a new Excel instance from a macro?

    I tried that:
    HTML Code: 
    I can see Excel is thinking, but it does not open. Would you know if there is anything I missed?
    thanks again for your previous suggestion.
    -Phil

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: open a new Excel instance from a macro?

    Try making the new instance of Excel visible, then you can see what's happening in it when you open the workbook.
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: open a new Excel instance from a macro?

    I also tried
    HTML Code: 
    but I am missing something.
    Last edited by mortphil; 06-26-2014 at 04:58 AM.

  7. #7
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: open a new Excel instance from a macro?

    sorry, norie. I posted the above before seeing that you replied.

    Where can I set it to visible. Is there a line of code or should I go in excel options.

    I keep digging, thanks

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: open a new Excel instance from a macro?

    Please Login or Register  to view this content.
    for instance. I tend to use other instances only for background processing so don't usually show them.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: open a new Excel instance from a macro?

    Add this after the line that creates the new instance.
    Please Login or Register  to view this content.
    You should now be able to see if anything, eg an update links dialog, is causing the new instance of Excel to hang.

  10. #10
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: open a new Excel instance from a macro?

    Awesome, Thanks guys.

    I did not know about this "New Excel.Application". I will use it a lot !

    If I want to refer to a macro that is within that workbook I open in this new instance.

    Can I refer to it as follows:

    HTML Code: 

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: open a new Excel instance from a macro?

    No - you need to use run:
    Please Login or Register  to view this content.
    for example.

  12. #12
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: open a new Excel instance from a macro?

    Thanks. I always wondered what is the difference between Run and Call.

  13. #13
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: open a new Excel instance from a macro?

    Quite a lot.
    Run breaks the call stack but also allows you to run code that Call won't (e.g. Private routines, routines in non-referenced projects).

  14. #14
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: open a new Excel instance from a macro?

    I still have a lot to learn

    I tried running my macro in the new instance. Obviously it does not work because one needs to enables macros first. I remember looking for a way to that via code but I don't think it's possible for security reasons. it looks like, I will have to click "Enable macros" when it opens.

  15. #15
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: open a new Excel instance from a macro?

    Don't we all?

    You shouldn't need to do it manually:

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: open a new Excel instance from a macro?

    Thanks that does the trick.

    Now I need to rewrite my exiting macros cuz I refer to the workbook as activeworkbook and it's no longer the one active.

    Thanks again for the above. EXTREMELY useful!!

  17. #17
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: open a new Excel instance from a macro?

    Glad to help. Please remember to mark the thread solved.

  18. #18
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: open a new Excel instance from a macro?

    mortphil

    Won't the workbook you open in the new instance be the active workbook in that instance?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to Open webpages in new instance of Chrome, close after X time.
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2013, 08:15 PM
  2. Open a New Instance of Excel On Top
    By c_leven3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-04-2010, 11:26 AM
  3. Open new excel instance - bug
    By tapapad in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2008, 05:34 PM
  4. Open only one instance of Excel - 2003
    By poppy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-12-2006, 05:55 AM
  5. [SOLVED] How do i open a new instance Excel?
    By Michael D. Reed in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-03-2005, 03:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1