How to set certain size with macro

J

Jan Kratochvil

I use this macro for include picture in my document
I would like to know if is possible to set the size of picture on certain
size automaticaly e.g. on 50%
----------------------
Sub InsertIncludeImageFieldWithImageStyle()
'
' InsertINCLUDEPICTURE With Image Style Makro
'
'Insert INCLUDEPICTURE field
Selection.Style = ActiveDocument.Styles("image")
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"INCLUDEPICTURE ""images/"" ", PreserveFormatting:=True
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Fields.ToggleShowCodes
' Image frame
With Selection.InlineShapes(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With

End Sub
 
B

Brian

Sub AllPictSize()
Dim PercentSize As Integer
Dim oIshp As InlineShape
Dim oshp As Shape
PercentSize = InputBox("Enter percent of full size", "Resize Picture", 9)
For Each oIshp In ActiveDocument.InlineShapes
With oIshp
..ScaleHeight = PercentSize
..ScaleWidth = PercentSize
End With
Next oIshp
For Each oshp In ActiveDocument.Shapes
With oshp
..ScaleHeight Factor:=(PercentSize / 100), _
RelativeToOriginalSize:=msoCTrue
..ScaleWidth Factor:=(PercentSize / 100), _
RelativeToOriginalSize:=msoCTrue
End With
Next oshp
End sub

Hope this helps,
 

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