+ Reply to Thread
Results 1 to 2 of 2

compress pictures

  1. #1
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    186

    compress pictures

    Gurus,

    I have searched far and wide for a vba code to compress all pictures in a worksheet. Below is the best I could find, however, I am not sure what the code is doing or what the settings are? Does anyone have any idea? The options I would like is to:

    1) compress all pictures
    2) delete cropped areas of pictures
    3) use default resolution

    Please Login or Register  to view this content.
    I have also found another line which replaced
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    Not sure what the difference is.

    TIA,
    Tim
    Attached Images Attached Images

  2. #2
    Forum Contributor Gregor y's Avatar
    Join Date
    10-24-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2010 32-Bit
    Posts
    280

    Re: compress pictures

    Warning: Your Mileage Will Likely Vary
    Please Login or Register  to view this content.
    On my system(excel 2010 - 32bit) and test xlsx this command pops two different dialogs:
    + if a picture(shape) is selected the dialog is almost the same as what you have take a screenshot of, except that the last option instead reads "Use document resolution"
    + if a picture is not selected it shows a completely different dialog

    The SendKeys statement sends key strokes to the active application which in this case is Excel.

    "%e" is alt+e, and "~" is enter, I'm assuming these are hotkeys for an earlier version of Excel; likewise "%w" alt+w should probably be "%(jpm)" which would be the hotkey
    to launch the same dialog as what the highlighted line does.

    The problem on my test run was that once the dialog pops, it freezes the VBA run until it gets resolved(OK/Cancel) so there was no way to control the options...

    My terrible solution was to use the false option right before popping the dialog in the hopes that the keys sent to the application would arrive after the dialog is shown and thus be consumed by the dialog itself

    this seemed to work at least in my test case, but having one bit of code out race another is not exactly good practice

    Please Login or Register  to view this content.
    If it'd make you feel better using my answer because of my street cred, then you can go ahead and click Add Reputation below to improve it.

+ 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. Compress Pictures - not working
    By wuorange in forum Excel General
    Replies: 2
    Last Post: 05-12-2023, 01:12 AM
  2. VBA Compress Pictures for Powerpoint Office 365 (windows 10)
    By truk2 in forum PowerPoint Programming
    Replies: 0
    Last Post: 05-21-2020, 01:51 AM
  3. Replies: 3
    Last Post: 01-19-2018, 09:17 AM
  4. Compress Comment Pictures to reduce file size in document
    By jholiday78 in forum Excel General
    Replies: 0
    Last Post: 09-19-2014, 03:32 PM
  5. Project management and pictures, basically make a day planner with pictures
    By Axe Doctor in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-10-2012, 12:58 PM
  6. Replies: 2
    Last Post: 07-11-2006, 01:35 PM
  7. [SOLVED] Excel's Compress Pictures or deleting pictures doesn't seem work
    By guidod in forum Excel General
    Replies: 1
    Last Post: 01-29-2006, 02:50 AM

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