Consulting

Results 1 to 3 of 3

Thread: Auto compress pictures

  1. #1

    Auto compress pictures

    Hi there,

    I want to automatticaly compress pictures i added to my worksheet. I used the next macro, it runs but does not compress the pictures.
    Has anyone got a solution?


    [VBA]Sub CompressPictures()
    ' Macro to compress all pictures
    ' Last change 7-1-2009
    Dim DrObj
    Dim Pict
    Set DrObj = ActiveSheet.DrawingObjects
    For Each Pict In DrObj
    If Left(Pict.Name, 7) = "Picture" Then
    Pict.Select
    'With Selection
    Selection.ShapeRange.PictureFormat.Brightness = 0.5
    Selection.ShapeRange.PictureFormat.Contrast = 0.5
    Selection.ShapeRange.PictureFormat.ColorType = msoPictureAutomatic
    Selection.ShapeRange.PictureFormat.CropLeft = 0#
    Selection.ShapeRange.PictureFormat.CropRight = 0#
    Selection.ShapeRange.PictureFormat.CropTop = 0#
    Selection.ShapeRange.PictureFormat.CropBottom = 0#
    'End With
    End If
    Next
    End Sub[/VBA]

  2. #2
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    404
    Location
    It's strange, but M$ didn't give the possibility of image compression by VBA. You can only try by SendKeys.

    Artik

  3. #3
    That is a pitty! I do not have experience with sendkeys but i will check the forum.

    Thanks, Ron.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •