+ Reply to Thread
Results 1 to 5 of 5

Remove old users to speed up shared workbook

  1. #1
    Registered User
    Join Date
    09-21-2020
    Location
    Scotland
    MS-Off Ver
    Standard 2016
    Posts
    8

    Remove old users to speed up shared workbook

    Hi All,

    My team use a shared, macro-enabled (.xlsm) workbook, with roughly 25 users in it at the same time, 24 hours a day.

    Over a few days, the shared user list gets full up, sometimes people's entries appear in there 4 or 5 times each. This causes the workbook to get bogged down which eventually results in it becoming corrupted and most of the time data loss occurrs as a system backup has to be restored through 'previous versions' in the folder properties.

    My only way to fix this at the moment is to regularly ask everyone to save their work and exit the spreadhseet, so I can unshare and re-share it, which clears the list. The issue with this is when multiple users try to save at the same time, the 'file locked' message appears, so each of the 25 odd users has to keep trying to save until they've all saved which ends up being hours sometimes that the spreadsheet is out of use. Then each has to confirm via email they've saved and exited (as I have to temporarily move the spreadsheet from the shared drive to my desktop to stop it being accessed whilst I'm trying to fix it).

    With users all over the globe, working at all different times, this is just a complete pain in the posterior, as you can probably imagine. Also, despite being told not to numerous times, users leave the shared excel open and then log off, disconnecting the VPN, when they've finished their shift. I'm pretty sure this doesn't help the situation.

    So I did a little bit of digging, and came accross the following VBA code (from superuser.com/questions/961918/how-do-you-prevent-corruption-of-shared-excel-files) which is supposed to remove all shared users who have been in the workbook for more than X hours.

    I'm using all of the below macros but can't get the bolded "SharedUserCheck" macro to work.

    I click run, I get a spinning wheel and then nothing happens (entires greater than 12 hours are still there). I'm trying to run this with the workbook still shared, as this is supposed to work:

    Please Login or Register  to view this content.
    I've got very minimal knowledge of VBA code, so wondering if someone could provide a simple explanation, for a noob?

    I'm using Microsoft Office Standard 2016.

    Kind Regards
    Chris
    Last edited by Chris_010101; 02-12-2021 at 08:29 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Remove old users to speed up shared workbook

    Sounds like it's time to move to 365 and the nes 'Collaberation' functionality.

    Many of us avoided shared workbooks like the plague since they just produce too many problems and seriously limit Excel's functionality. I fear that adding macros probably just compounds any difficulties.

    Incidenatally please note we have a rule about wrapping macro code in [CODE ][ / CODE] tags
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    09-21-2020
    Location
    Scotland
    MS-Off Ver
    Standard 2016
    Posts
    8

    Re: Remove old users to speed up shared workbook

    Quote Originally Posted by Richard Buttrey View Post
    Incidenatally please note we have a rule about wrapping macro code in [CODE ][ / CODE] tags
    Hi Richard,

    Getting my company, which employes upwards of 230,000 people globally, to deploy 365 is going to be a gargantuan task for a lackey such as myself. Nevertheless, I shall email the CEO on Monday with my request...

    ..I have wrapped the macros as you requested. Apologies, I was unaware of this rule.

    Best Wishes,
    Chris

  4. #4
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Remove old users to speed up shared workbook

    I've dealt with multiple simultaneous users trying to save at the same time. I can't provide code because my employer owns what I implemented, and any variation I could try would still be subject to copyright. However, I believe I can describe the approach.

    Use a Workbook_BeforeSave event handler. That handler would check whether a file with a given pathname on a network share existed, a simple form of semaphore. If not, create that other file, save the workbook, and delete that other file. If that other file did exist, call Application.OnTime to call a simple macro which only calls ThisWorkbook.Save after a given delay, set the event handler's Cancel parameter to True, optionally display a message saying the workbook hasn't been saved but is scheduled to be saved after delay. I use a macro to display modeless dialogs which disappear after a different delay.

  5. #5
    Registered User
    Join Date
    09-21-2020
    Location
    Scotland
    MS-Off Ver
    Standard 2016
    Posts
    8

    Re: Remove old users to speed up shared workbook

    Hi All,

    Wondering if anyone with knowledge of VBA could kindly provide a solution to the SharedUserCheck macro issue?

    Regards
    Chris
    Last edited by Chris_010101; 02-13-2021 at 06:44 PM. Reason: Updating ask

+ 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: 04-05-2016, 11:41 AM
  2. Multiple Users in a Shared Workbook
    By athyeh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-06-2014, 05:38 PM
  3. Replies: 1
    Last Post: 01-28-2005, 09:06 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