VBA picture recolouring

icecurtain

Board Regular
Joined
Jun 24, 2010
Messages
66
Purpose to recolour and soften all pictures that are greater than 100X100

I have created this macro in word VBA as a have a 500 page document with 100s of pictures, but I am sure excel will reacts the same.

But I only want to recolour pictures in my document that are greater than

Height = 100 Width = 100

and ingore the rest what do I need to add to my statement please?


Code:
   Sub recolour()
    '
    ' recolour Macro
    Dim Pic As InlineShape
    For Each Pic In ActiveDocument.InlineShapes
    Pic.PictureFormat.ColorType = msoPictureGrayscale
    Pic.SoftEdge.Type = msoSoftEdgeType5
    Next
    End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try

Code:
Sub recolour()
'
' recolour Macro
Dim Pic As InlineShape
For Each Pic In ActiveSheet.InlineShapes
If Pic.Height >= 100 And Pic.Width >= 100 Then
    Pic.PictureFormat.ColorType = msoPictureGrayscale
    Pic.SoftEdge.Type = msoSoftEdgeType5
End If
Next Pic
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top