+ Reply to Thread
Results 1 to 5 of 5

"reset" pictures programmatically with vba

  1. #1
    Registered User
    Join Date
    06-03-2013
    Location
    Denver, Colorado, US
    MS-Off Ver
    Mac Office 2011/Windows Office 2013
    Posts
    6

    "reset" pictures programmatically with vba

    Hey guys,

    I've got a workbook that runs on mac and pc. One of the problems with this is that pictures added in one platform lose their aspect ratio when opened on the other.

    This can be fixed by using the "reset" button in the "format pictures" tab on the ribbon, but I don't know how to do that with vba. I gave up trying to compress pictures with vba, and this is another ribbon object so I don't know if this is possible.

    The other alternative is to tag each picture so I know which platform is was imported in, that way I can check and resize when the workbook is opened in the other platform (the aspect ratio of a picture imported in windows and then opened in mac increases by a factor of ~1.226, so I can resize them again).

    Another alternative is one that I don't know about that you awesome people can teach me! I like that one, or being able to access the "reset" button in the "format pictures" tab on the ribbon.

    Thanks,

    Tim

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: "reset" pictures programmatically with vba

    Maybe you can adapt something like this:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-03-2013
    Location
    Denver, Colorado, US
    MS-Off Ver
    Mac Office 2011/Windows Office 2013
    Posts
    6

    Re: "reset" pictures programmatically with vba

    Quote Originally Posted by JBeaucaire View Post
    Maybe you can adapt something like this:
    You rock, and that saves so much time and is so much easier!

    For those trying to do the same thing as me, which is to have a semi-complex userform and pictures that work across Mac and Windows (and multiple versions of windows XL), here's some nice info:

    i) Preprocessor commands (with a # symbol before them) are a handy way to make your code dynamic for a given platform, e.g.:

    Please Login or Register  to view this content.
    ii) Userforms themselves change size between Mac and Windows. This code by Ron de Bruin is very handy for that.

    iii) Pictures are also resized (aspect ratio changes) between Mac and Windows. For example, a picture imported into XL in Windows will experience an aspect ratio (width/height) change of ~1.226 when the XL file is opened in Mac. Similarly, if imported into XL in Mac and opened in Windows, the change is ~/1.226, or ~0.8155. JBeaucaire's above code works great for pictures that HAVE NOT been resized after being imported into XL. For pictures that have been resized in XL after being imported, change the second argument to "False" to resize relative to current size, such as in the following code:


    Please Login or Register  to view this content.
    (I changed the height, but the same result can be achieved by scaling the width)

    Thanks again!

    Tim

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: "reset" pictures programmatically with vba

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Thanks.

  5. #5
    Registered User
    Join Date
    06-03-2013
    Location
    Denver, Colorado, US
    MS-Off Ver
    Mac Office 2011/Windows Office 2013
    Posts
    6

    Re: "reset" pictures programmatically with vba

    Fancy!! I'll do that.

    To correct my last post, you have to use a correction factor (not 1) for ALL pictures between mac and windows, not just those that have been resized.

    Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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