+ Reply to Thread
Results 1 to 6 of 6

Issue with Macro since Office 365 upgrade

  1. #1
    Registered User
    Join Date
    01-22-2020
    Location
    Midwest, USA
    MS-Off Ver
    Office 365
    Posts
    3

    Post Issue with Macro since Office 365 upgrade

    Hello! I have been dealing with this issue for some time now, hoping someone can help me out

    I have a set of workbooks that I refresh monthly. I took this over from someone else, who wrote the blue VBA code below. I believe the purpose of it is to only allow certain users to open and save the workbook, while forcing others to access it in read-only mode. I never had an issue doing this until recently when we upgraded from Office 2016 to Office 365. Now whenever I open the workbook I get the following error message:

    Run-time error '1004': Cannot access read-only document '[workbook url]'.

    When I select "debug", it jumps to the "User = UserStatus(1, 1)" line, which makes me think that my username [format is: "Doe, John (J.)"] is not being recognized. However, I can't tell why this is suddenly happening or how to fix it. I've tried searching for this issue but I cannot figure it out, so any and all help is greatly appreciated!

    Please Login or Register  to view this content.
    Last edited by Pepe Le Mokko; 01-22-2020 at 01:07 PM.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Issue with Macro since Office 365 upgrade

    You will need to find out what UserStaus is by stepping through the code using F8 while running the workbook in an Excel 2016 envirement.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,443

    Re: Issue with Macro since Office 365 upgrade

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules. Thanks

  4. #4
    Registered User
    Join Date
    01-22-2020
    Location
    Midwest, USA
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Issue with Macro since Office 365 upgrade

    I can't find UserStatus anywhere else in the workbook. I see that it is an Excel property, however.

    Microsoft defines the UserStatus property as: "Returns a 1-based, two-dimensional array that provides information about each user who has the workbook open as a shared list. Read-only Variant."

    Apparently the syntax is
    Please Login or Register  to view this content.
    , which does not seem to resemble the usage in my script.

  5. #5
    Registered User
    Join Date
    01-22-2020
    Location
    Midwest, USA
    MS-Off Ver
    Office 365
    Posts
    3

    Re: Issue with Macro since Office 365 upgrade

    Thanks for your help!

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Issue with Macro since Office 365 upgrade

    The proper syntax would be either Activeworkbook.UserStatus or ThisWorkbook.UserStatus.

    The (1,1) refers to the name of the user(s). In my case it only returns 1 name as a string so I don't get the meaning of the following lines of the code.

+ 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. VBA Compile Error appears with upgrade to Office 2013 from Office 2010
    By MathUKTeacher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-09-2019, 10:22 AM
  2. Macro not woking in Upgrade format of MS Office
    By Liju144 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2014, 12:40 AM
  3. Macro issue may have when upgrade excel from 2003 to 2013
    By lhollis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-30-2013, 03:21 AM
  4. Office 2010 upgrade
    By Spfsnana in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2012, 10:28 AM
  5. New Macro error after Office Upgrade
    By Marc in forum Excel General
    Replies: 9
    Last Post: 03-03-2006, 05:15 PM
  6. Excel Upgrade - Office XP
    By Lisa Beach in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-21-2005, 03:05 AM
  7. [SOLVED] Is it worthwhile to upgrade Office 2000 to Office 2003?
    By Tim Zych in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-26-2005, 03: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