+ Reply to Thread
Results 1 to 4 of 4

excel instances

  1. #1
    Registered User
    Join Date
    11-10-2019
    Location
    México
    MS-Off Ver
    2003, 2007, 2010, 2013, 365
    Posts
    4

    excel instances

    Hi, all !

    this is driving me crazy...

    I need to work with an excel file in a separate instance
    there may be more than one instance of excel running or only the one I am using, then...

    I can create a separate instance with createobject(... or
    I can get the instance that has my file in use with getobject("fullPath To myFile.xlsx").application

    However, using this (in the same procedure) e.g.
    PHP Code: 
      Set xlApp GetObject("fullPath To myFile.xlsx").Application
      
    If xlApp Is Nothing Then
        Set xlApp 
    CreateObject("excel.application")
        
    xlApp.Workbooks.Open "fullPath To myFile.xlsx"
      
    End If 
    if I search first for the instance that uses it (getobject) and I get my xlApp, everything works ok, BUT...
    if it results in nothing, I fail to get the second call (createobject) to create a separate instance

    even more, with the second call...
    in addition to opening my file in the same instance I am using, opens it with its workbook window hidden

    tested with versions 2003, 2007, 2010, 2013 and 365 (up to date > insider > beta)

    any help, guidance or alternative will be highly appreciated (I would like to avoid calls to APIs)

    TIA,
    hector.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    2016 primarily
    Posts
    7,245

    Re: excel instances

    CreateObject will create a new instance of Excel. It will not reuse an existing one. What makes you think it is?
    Rory

  3. #3
    Registered User
    Join Date
    11-10-2019
    Location
    México
    MS-Off Ver
    2003, 2007, 2010, 2013, 365
    Posts
    4

    Re: excel instances

    Hi, rorya, thanks for the prompt response

    sorry if I wasn't clear enough
    I'm not assuming that could happen
    I'm suffering that's exactly what's going on

  4. #4
    Registered User
    Join Date
    11-10-2019
    Location
    México
    MS-Off Ver
    2003, 2007, 2010, 2013, 365
    Posts
    4

    Re: excel instances

    hi, all !

    just FWIW:

    the culprit is getobject("fullPat To myFile.xlsx").application from an instance of the same application because it is the instance used to open it, then createobject has nothing to do

    it is strange for the book to open in a hidden window

    it seems that there is no way to avoid API calls

+ 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. Replies: 3
    Last Post: 06-24-2021, 10:41 AM
  2. VLookup 2 instances in a table with 2 instances horizontal and vertical
    By vivek.budhram in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-08-2019, 11:47 AM
  3. [SOLVED] Complex VLOOKUP, multiple instances vertical, return subsequent instances horizontally
    By Miles_2804 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-12-2013, 11:54 AM
  4. Replies: 0
    Last Post: 04-11-2013, 10:18 AM
  5. Replies: 3
    Last Post: 07-18-2012, 11:53 AM
  6. [SOLVED] Excel Instances
    By StephanieH in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 11-17-2005, 03:40 PM
  7. 2 instances of excel
    By John in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-17-2005, 09:05 AM

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