+ Reply to Thread
Results 1 to 13 of 13

The macro Workbook_Open() does not work on macOS

  1. #1
    Registered User
    Join Date
    12-25-2023
    Location
    Moscow
    MS-Off Ver
    MS Office 16
    Posts
    6

    The macro Workbook_Open() does not work on macOS

    Good day everyone!
    There is a file (in the application) that, using macros, allows you to create authorization with different levels of access to different sheets of the book.

    The essence of the problem is this: the file works fine on Windows, it also works on a MacBook up to 2017 inclusive in office 16. The selection of Macs is not very large, where I tried to open it, but on MacBooks older than 17 years old, when opening the file, the message "Invalid procedure call or argument" appears and Visual Basic opens with the red line highlighted in yellow below.

    This code is written in ThisWorkBook.

    Please Login or Register  to view this content.
    Offices were 16 and 19. The names of all modules seemed to be written in Latin. Macros were enabled on all MacBooks. Has anyone encountered this problem, or can they help get it to run on any Mac? Thank you very much in advance for your advice))

    For the default login, the login is Admin, the password is 1.
    Attached Files Attached Files
    Last edited by alansidman; 12-25-2023 at 11:18 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: The macro Workbook_Open() does not work on macOS

    Administrative Note:

    We would very much like to help you with your query, however your post does not comply with our guidelines

    Please take a moment to review how to add code tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Guideline #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 have added the code tags for you today. Please take a few minutes to re-read our guidelines and rules that you agreed to when you joined and comply in the future.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: The macro Workbook_Open() does not work on macOS

    Quote Originally Posted by Aromis View Post
    ... on MacBooks older than 17 years old, when opening the file, the message "Invalid procedure call or argument" appears ...
    Please Login or Register  to view this content.
    In "old excels" (if there is one installed there and not a new one), the equivalent of the "Workbook_Open" event was the "Auto_Open" event (in win sys).
    Unfortunately, I have no one reference to what it looked like in "Offices for Mac".
    To open old excel files with the "Auto_Open" in new excel installations, we must use the "Workbook.RunAutoMacros" method (described in the contextual help of the VBA editor) however, this is not possible in the "opposite direction" - "nam nuzhno redaktirovat' makrosy".

  4. #4
    Registered User
    Join Date
    06-24-2009
    Location
    Maldives
    MS-Off Ver
    MS 365 Subscription, v.2308
    Posts
    14

    Re: The macro Workbook_Open() does not work on macOS

    Quote Originally Posted by Aromis View Post
    Good day everyone!
    There is a file (in the application) that, using macros, allows you to create authorization with different levels of access to different sheets of the book.

    The essence of the problem is this: the file works fine on Windows, it also works on a MacBook up to 2017 inclusive in office 16. The selection of Macs is not very large, where I tried to open it, but on MacBooks older than 17 years old, when opening the file, the message "Invalid procedure call or argument" appears and Visual Basic opens with the red line highlighted in yellow below.

    This code is written in ThisWorkBook.

    Please Login or Register  to view this content.
    Offices were 16 and 19. The names of all modules seemed to be written in Latin. Macros were enabled on all MacBooks. Has anyone encountered this problem, or can they help get it to run on any Mac? Thank you very much in advance for your advice))

    For the default login, the login is Admin, the password is 1.
    How about this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-25-2023
    Location
    Moscow
    MS-Off Ver
    MS Office 16
    Posts
    6

    Re: The macro Workbook_Open() does not work on macOS

    Quote Originally Posted by zameel View Post
    How about this
    Please Login or Register  to view this content.
    Unfortunately it doesn’t work, when saving it VBA says a compilation error

  6. #6
    Registered User
    Join Date
    12-25-2023
    Location
    Moscow
    MS-Off Ver
    MS Office 16
    Posts
    6

    Re: The macro Workbook_Open() does not work on macOS

    UPD. The file works on Intel processors, but not on M2 processors. Is there any solution to this problem?

  7. #7
    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: The macro Workbook_Open() does not work on macOS

    I thought you said older Macs were the problem?
    Rory

  8. #8
    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: The macro Workbook_Open() does not work on macOS

    Try changing the code name of the sheets to something in English like Sheet1 or MAIN

  9. #9
    Registered User
    Join Date
    12-25-2023
    Location
    Moscow
    MS-Off Ver
    MS Office 16
    Posts
    6

    Re: The macro Workbook_Open() does not work on macOS

    Quote Originally Posted by rorya View Post
    I thought you said older Macs were the problem?
    Sorry, apparently it looked incorrect. On old MacBooks everything works fine, but on new ones it doesn’t, especially with non-Intel processors.

  10. #10
    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: The macro Workbook_Open() does not work on macOS

    Making the changes I suggested worked for me with an M2 MacBook

  11. #11
    Registered User
    Join Date
    12-25-2023
    Location
    Moscow
    MS-Off Ver
    MS Office 16
    Posts
    6

    Re: The macro Workbook_Open() does not work on macOS

    Quote Originally Posted by rorya View Post
    Making the changes I suggested worked for me with an M2 MacBook
    Seriously? I renamed all the sheets to English, but the file still didn’t work... Can you attach to the message the file that worked for you?

  12. #12
    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: The macro Workbook_Open() does not work on macOS

    Did you change the code names or the name on the tabs? You need to change the code names.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    12-25-2023
    Location
    Moscow
    MS-Off Ver
    MS Office 16
    Posts
    6

    Re: The macro Workbook_Open() does not work on macOS

    Everything worked!) Thank you very much for your help! The topic can be closed

+ 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. MacOs - How to close code windows? AND how to reorder the debug bar [MacOS]
    By lord anubis in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 2
    Last Post: 06-05-2022, 02:02 PM
  2. Macro work well on windows but Macos give error 91
    By mazan2010 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-30-2020, 04:10 PM
  3. Workbook_Open() won't work
    By Macro Daddy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-10-2010, 12:24 PM
  4. Workbook_Open doesn't work
    By Magic_Doctor in forum Excel General
    Replies: 2
    Last Post: 07-28-2009, 01:08 PM
  5. Workbook_open event doesn't work
    By sapphire in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-26-2008, 01:53 PM
  6. Workbook_Open() does not work
    By Ken in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2006, 01:55 PM
  7. Can't get Workbook_Open event to work
    By M Smith in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2005, 02: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