+ Reply to Thread
Results 1 to 7 of 7

Determine Number of Instances of Excel Running.

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Determine Number of Instances of Excel Running.

    Hi all,

    I've been stumbling around with this for awhile now. I was wanting some code that could
    tell me if a workbook is open. However, I am wanting it to be able to check for the workbook within another instance of a excel app if running in a different thread.

    I searched the internet for some exsisting code and could only find the following that looked promising.

    http://www.eggheadcafe.com/microsoft...xcel-open.aspx

    However, after inserting the code and making a few tweaks to the declarations.
    I'm now stumbeling on the following line of code .

    Please Login or Register  to view this content.
    sBuff, appears to be empty, I'm not sure what sBuff is suppose to hold.

    Here's the full code I'm trying to use.

    Please Login or Register  to view this content.


    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

    Any help is appreciated.

    Thanks,

    BDB
    Last edited by bdb1974; 11-01-2011 at 02:30 PM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Determine Number of Instances of Excel Running.

    The Alias for GetClassName was not set.

    Please Login or Register  to view this content.

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Determine Number of Instances of Excel Running.

    Probably simpler:

    Please Login or Register  to view this content.



  4. #4
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Determine Number of Instances of Excel Running.

    Thanks for the response guys.

    The Alias for GetClassName was not set.

    Hoping you can give me a little more info instead of struggling anymore...
    How do I set this and to what? Is it the Workbook name?

    I'll give both methods a try. Right now , my day is done.

    Thanks again,

    BDB

  5. #5
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Determine Number of Instances of Excel Running.

    Got SNB method to work for me.

    I'm still curious on the other method for educational purposes.
    Just not sure what needs to be done.

    Tried setting sBuff = "test.xlsx"

    and

    GetClassNameA = "test.xlsx"

    Neither works.

    NE1 knows please help.
    BDB

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Determine Number of Instances of Excel Running.

    No, you don't send any filename. Just put my code into a Module and run Test_ExcelCount or as a UDF put =ExcelCount as a cell formula. As a UDF, it would update at each calculation.

    I have used the other method on the link as well.

    Of course this is just the first part of what you need, count instances of Excel.
    Last edited by Kenneth Hobson; 11-01-2011 at 02:30 PM.

  7. #7
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Determine Number of Instances of Excel Running.

    Sorry Ken. I didn't realize you had posted a correction.

    You're right, I plugged it into a module and stepped through the code.

    Works like a charm!

    Thanks,

    BDB

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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