+ Reply to Thread
Results 1 to 13 of 13

Create a new Excel application if one is already running

  1. #1
    Registered User
    Join Date
    04-24-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    57

    Create a new Excel application if one is already running

    Hi there,

    As you have noticed, every time you open any spreadsheet with code "Application.visible=False" it obviously hides also other running Excel application. Now, I want to check first if application is already running and if so, then create a new application and run my code there. How can this be done?

    Cheers,
    Ville

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,689

    Re: Create a new Excel application if one is already running

    Not sure if this helps?
    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

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

    Re: Create a new Excel application if one is already running

    Can't you run the code in the current instance of Excel?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    04-24-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Create a new Excel application if one is already running

    millz, thank you for your help. That piece of code really allows me to open another application. However, now I need to go back to original application and close that same worksheet that was just used to open new application. This seems to be tricky part for me now.

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

    Re: Create a new Excel application if one is already running

    If you want to close the instance of Excel the code is in you can use this.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-24-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Create a new Excel application if one is already running

    Norie, thank you for your reply. However, now when I open another Excel file in a new application it becomes active one. Now, because that new application is active one I need to write some code there to return back to the original one or some other way to close original Excel file. And to answer your previous comment is that I cannot run in the current instance because user has to have access to other active workbooks and my code hides application and turn screenupdating off.

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

    Re: Create a new Excel application if one is already running

    Have you tried putting the code I suggested in the code in the original instance of Excel?

    That code should still have 'focus' after you've created the new instance.

  8. #8
    Registered User
    Join Date
    04-24-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Create a new Excel application if one is already running

    Hi Norie,

    It seems like that when new instance is created and at the new instance Thisworkbook contains a macro where a userform is started, the focus is on the new instance. Then, after new instance closes, focus goes back to "original" one.

  9. #9
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,689

    Re: Create a new Excel application if one is already running

    Am I missing some background information? I am not sure if this will stop the code from running from the original workbook/application.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-24-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Create a new Excel application if one is already running

    Hi Millz,

    That code above will definitely work but I need to open a certain file in new instance and this certain file will open userform when workbook opens. So, when this new file is opened it starts code immediately, unfortunately leaving original instance on background to wait until new instance stops running. Is there some way to around this?

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

    Re: Create a new Excel application if one is already running

    Do you want the userform to open when you open the other workbook?

  12. #12
    Registered User
    Join Date
    04-24-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Create a new Excel application if one is already running

    Norie, yes.

  13. #13
    Registered User
    Join Date
    04-24-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Create a new Excel application if one is already running

    Ok guys. Was ablew to find a solution for this problem.

    This one to ThisWorkbook:
    Please Login or Register  to view this content.
    And this one to module:
    Please Login or Register  to view this content.

+ 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. [SOLVED] Excel 2010 VBA Macro Stops Running After Application.Wait
    By DMumme in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-10-2014, 09:10 AM
  2. Running Windows based Excel Application on a Mac
    By ravichander in forum Excel General
    Replies: 8
    Last Post: 05-03-2011, 01:23 PM
  3. use excel to send and recievr from another already running non ms application
    By martindwilson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-19-2009, 04:33 PM
  4. Running Excel 2000 VBA Application on Excel 2003
    By in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-08-2006, 01:05 PM
  5. [SOLVED] Excel VBA Macro Running DOS Application !!
    By monir in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-25-2006, 11:00 PM

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