What's the macro code to make the selected item 75% of its size, wantto keep proportions

J

John

Hi

I tried do this by recording a macro (rather than writing code by
hand) but the resulting macro doesn't work when applied to other,
different objects :(


This is the resulting code:

Sub make75percent()
'
' make75percent Macro
'
'
Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Solid
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalse
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 127.85
Selection.InlineShapes(1).Width = 315.5
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType =
msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#
End Sub
 
J

Jean-Baptiste Bertrand

Try :

Sub Resize()
Dim init_width As Long
Dim init_height As Long
Dim new_width As Long
Dim new_height As Long

init_width = Selection.InlineShapes(1).Width
init_height = Selection.InlineShapes(1).Height

new_width = (init_width * 75) / 100
new_height = (init_height * 75) / 100

Selection.InlineShapes(1).Width = new_width
Selection.InlineShapes(1).Height = new_height
End Sub

It will resize the image which is currently selected.

Jean-Baptiste
 
J

John

Try :

Sub Resize()
    Dim init_width As Long
    Dim init_height As Long
    Dim new_width As Long
    Dim new_height As Long

init_width = Selection.InlineShapes(1).Width
init_height = Selection.InlineShapes(1).Height

new_width = (init_width * 75) / 100
new_height = (init_height * 75) / 100

Selection.InlineShapes(1).Width = new_width
Selection.InlineShapes(1).Height = new_height
End Sub

It will resize the image which is currently selected.

Jean-Baptiste






- Show quoted text -


How strange - it appears to resize items to about 56% or 57%.

Is there a way of setting it so that if I accidently click it twice,
it doesn't become really small (75% of 75%)?

Thanks for taking the time to help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top