+ Reply to Thread
Results 1 to 9 of 9

Compile error: Method or data member not found error [Only on Mac; OK on Windows]

  1. #1
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    326

    Compile error: Method or data member not found error [Only on Mac; OK on Windows]

    Hi,

    I have the following code that works perfectly on a Windows machine, but generates that compile error on a Mac.

    The piece of code that blows up is ".Unprotect" in this simple loop:

    Please Login or Register  to view this content.
    The entire macro where that code snippet lies is:
    Please Login or Register  to view this content.
    Thanks for any guidance on this!

    Lawrence
    Last edited by 6StringJazzer; 10-03-2019 at 01:55 PM. Reason: clarified title

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Compile error: Method or data member not found error

    I don't have a Mac so I can't test this, but how is ws declared? Is pWord longer than 15 characters? Does this fail on the first worksheet attempted, or does it successfully unprotect some sheets before it fails? (That error is a runtime error, not a compile error.)
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    326

    Re: Compile error: Method or data member not found error

    Thanks for the response!

    1. Dim ws As Worksheet
    2. pWord (for password) is only three characters: "SMC"
    3. Does it fail on the first attempt? Yes.
    4. Excel's error message is "Compile error: Method or data member not found" and highlights ".Unprotect". Absolutely baffles me how such a simple loop works in Windows but fails on the Mac.

    Lawrence

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Compile error: Method or data member not found error [Only on Mac; OK on Windows]

    I don't get an error from that bit on Mac Excel 16.30 but I can tell you your workbook won't ever work properly on a Mac because you are using ActiveX controls and they aren't supported at all.
    Rory

  5. #5
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    326

    Re: Compile error: Method or data member not found error [Only on Mac; OK on Windows]

    Thanks Rorya.

    The file uses forms controls option buttons. Is there ActiveX code in that macro?

    Lawrence

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Compile error: Method or data member not found error [Only on Mac; OK on Windows]

    Yes - the OLEObjects part at the end.

  7. #7
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    326

    Re: Compile error: Method or data member not found error [Only on Mac; OK on Windows]

    Ah...

    Those forms are Shapes!

    Would this fix it:

    Please Login or Register  to view this content.
    Lawrence

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Compile error: Method or data member not found error [Only on Mac; OK on Windows]

    You should be able to use:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    326

    Re: Compile error: Method or data member not found error [Only on Mac; OK on Windows]

    Once again, you have saved the day.

    Thank you!

    Lawrence

+ 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. [SOLVED] Compile Error: Method or data member not found
    By jtsev13 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-24-2018, 04:07 AM
  2. [SOLVED] compile error method or data member not found will not run as a sub
    By COURTTROOPER in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-05-2018, 12:31 PM
  3. Error Message: Compile Error: Method or data Member not found
    By blei in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-23-2017, 08:47 AM
  4. Error Message: Compile Error: Method or data Member not found
    By blei in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2017, 05:20 AM
  5. Compile Error Method or data member not found
    By ixelister in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2014, 03:39 PM
  6. [SOLVED] Compile error: Method or data member not found.
    By ndtsteve in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-10-2012, 11:31 AM
  7. Compile Error Method or data member not found
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2005, 06:05 PM

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