+ Reply to Thread
Results 1 to 5 of 5

Counting instances of Excel - wrong result in O365

  1. #1
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,981

    Counting instances of Excel - wrong result in O365

    Hi All,
    I have an addin which update from a server but I only want to perform this the first time the user opens Excel.
    So far I've achieved this by using this well known function to count the number of instances open.

    In a scenario where there is One Instance containing One Workbook, containing One Worksheet:
    It gives the expected result of 1 in earlier versions of Excel, but in Excel 365 32bit it returns 3

    I guess this has something to do with Excel moving to SDI (?) but does of a better way to achieve this?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: Counting instances of Excel - wrong result in O365

    What do you actually want a count of? If it's the number of running Excel processes, you can use WMI which is simpler:

    Please Login or Register  to view this content.
    called with:

    Please Login or Register  to view this content.
    Your current version, due to SDI as you said, is counting the number of workbooks, including hidden/ and xlam/xla format add-ins.
    Rory

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,981

    Re: Counting instances of Excel - wrong result in O365

    Hi,
    I have an xlam addin which checks on the server to see if there is an updated version there. If there is it prompts the user to update. (there's also a separate check so that if they decline the update it doesn't occur again on the same day).
    However I don't want this be uninstalling and resinstalling if (with MDI) multiple instances of Excel are running.

    So this check usually fires the first time they open excel which with MDI would be one instance.

    The problem I have was that this check wasn't firing in O365 as the instance count wasn't 1.

    I tried your alternative but it's still giving me 2, even with a single workbook open, but of course the addin itself is loaded.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: Counting instances of Excel - wrong result in O365

    My version counts the number of Excel.exe processes running - it doesn't attempt to determine how many workbooks might be in each. If you see 2, then there are two Excel processes running.

  5. #5
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,981

    Re: Counting instances of Excel - wrong result in O365

    Yes I do a separate workbook count. It returns 1 now, so the other process must have been a rogue one.
    Many thanks for your help.

+ 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. Excel Division - Wrong result
    By jerry787 in forum Excel General
    Replies: 3
    Last Post: 08-23-2019, 06:34 AM
  2. O365 Excel 64 bit problems
    By ks1102 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2019, 11:58 PM
  3. please help me add 1, 2 or 3 years to a date in Excel (O365)
    By Steve.west in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-22-2018, 04:24 PM
  4. Excel Assistance Needed - Counting Number of Instances
    By bdav1216 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-04-2016, 04:34 AM
  5. [SOLVED] Code result wrong but formula correct result
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-11-2014, 12:26 PM
  6. Macro giving wrong result for counting rows
    By aniletc37 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-11-2014, 07:57 AM
  7. excel result return wrong calcuation result
    By garyww in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-14-2006, 06:20 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