+ Reply to Thread
Results 1 to 11 of 11

Userform LoadPicture() not working on Mac

  1. #1
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Userform LoadPicture() not working on Mac

    I have a macro that collects and loads various peices of data, before performing calculations. As part of the process I need to show the user a graph of the applied electrical load so that they can then make choices further down the line.

    to do this, I generate a chart, save the image, and use loadPicture() to insert the image into an image object on the userform. On the mac this generates a "Sub or Function not defined" error for the LoadPicture() function

    Here is my relevant code in the userform. LoadCurveChart is the name of the userform image object.

    Please Login or Register  to view this content.
    My search tells me that there is a general problem with LoadPicture() on Mac. If anyone has suggestions for fixes or alternatives, it would be greatly appreciated.

    Note. This needs to run on other peoples computers, so any add-in requirements would need to be easy to install.

    Thanks in advance

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,438

    Re: Userform LoadPicture() not working on Mac

    I don't use Macs but have you tried this alternative?

    https://www.rondebruin.nl/mac/mac024.htm
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Userform LoadPicture() not working on Mac

    I hadn't seen this. I will give it a go tomorrow
    Last edited by truk2; 08-13-2018 at 12:24 AM.

  4. #4
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Userform LoadPicture() not working on Mac

    It took me a while to get back to this project (other things became #1 priority)

    I tried the RondeBriun code. When try to update the image, I get a "permission denied" error. I haven't found a solution to that yet

    NB I have a public global boolean IsMac that flag if the code is running on Mac or not

    Please Login or Register  to view this content.

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,266

    Re: Userform LoadPicture() not working on Mac

    You shouldn’t use backslashes in paths on the Mac. Use application.pathseparator instead.

  6. #6
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Userform LoadPicture() not working on Mac

    Thanks, will try that

  7. #7
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Userform LoadPicture() not working on Mac

    That worked.

    I am now able to get through the LoadPicture method. I have the methods in to use preview if system is mac
    However the existance of the loadpicture method in the other branch of the if statment throws a compile error as soon as the sub is accessed.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,266

    Re: Userform LoadPicture() not working on Mac

    Use conditional compilation:

    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  9. #9
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Userform LoadPicture() not working on Mac

    so the # makes it not compile the other path?

  10. #10
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Userform LoadPicture() not working on Mac

    Quote Originally Posted by rorya View Post
    Use conditional compilation:

    Please Login or Register  to view this content.
    That worked. THANKS!

  11. #11
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,266

    Re: Userform LoadPicture() not working on Mac

    Quote Originally Posted by truk2 View Post
    so the # makes it not compile the other path?
    Correct. It will only compile the part relevant to the OS.

+ 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. Loadpicture not working
    By Glherriott in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-07-2016, 01:41 PM
  2. LoadPicture() Issue
    By ykobure in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2015, 08:15 AM
  3. LoadPicture() Issue
    By ykobure in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2015, 10:48 AM
  4. LoadPicture from existing image/shape
    By mateoc15 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-07-2012, 05:16 AM
  5. Load picture into form not using 'LoadPicture'
    By pfrattali in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-14-2011, 02:07 AM
  6. LoadPicture for a ControlButton help
    By micmacuk in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-30-2006, 03:50 PM
  7. [SOLVED] conditional compile for LoadPicture?
    By RB Smissaert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2006, 10:15 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