Default formatting for pictures

S

Sandi Vogel

I am sick to death of pasting a screen shot into a Word document,
right-clicking on it, selecting format picture, change the size to 3" and
aligning it tight to the right. Does anyone have code for applying these
changes to the currently selected picture? Thanks in advance! -- Sandi
 
L

Lene Fredborg

The macro below may do what you want. It sets the wrapping style of the
selected shape to Tight and the Horizontal alignment to Right - both the
width and height of the shape are set to 3". The shape will be positioned
relative to the margin.

Note:
1. If the wrapping style of the selected shape is "In line with text" when
pasted, you must insert the following code line _before_ the line "Set oShape
=…":

Selection.InlineShapes(1).ConvertToShape

2. If you want to set only the width to 3" and scale the shape
proportionally, change “msoFalse†to “msoTrue†in the line : “
LockAspectRatio = msoFalse†(the “:Height =…†line is without importance
then).


The macro:

Sub ResizeAndPositionScreenDump()

Dim oShape As Shape

Set oShape = Selection.ShapeRange(1)
With oShape
‘Change msoFalse to msoTrue to scale proportionally
.LockAspectRatio = msoFalse
.Width = InchesToPoints(3)
.Height = InchesToPoints(3)
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = wdShapeRight
.WrapFormat.Type = wdWrapTight
End With

End Sub

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
S

Sandi Vogel

Works like a charm! Thanks so muchl

Lene Fredborg said:
The macro below may do what you want. It sets the wrapping style of the
selected shape to Tight and the Horizontal alignment to Right - both the
width and height of the shape are set to 3". The shape will be positioned
relative to the margin.

Note:
1. If the wrapping style of the selected shape is "In line with text" when
pasted, you must insert the following code line _before_ the line "Set oShape
=…":

Selection.InlineShapes(1).ConvertToShape

2. If you want to set only the width to 3" and scale the shape
proportionally, change “msoFalse†to “msoTrue†in the line : “
LockAspectRatio = msoFalse†(the “:Height =…†line is without importance
then).


The macro:

Sub ResizeAndPositionScreenDump()

Dim oShape As Shape

Set oShape = Selection.ShapeRange(1)
With oShape
‘Change msoFalse to msoTrue to scale proportionally
.LockAspectRatio = msoFalse
.Width = InchesToPoints(3)
.Height = InchesToPoints(3)
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = wdShapeRight
.WrapFormat.Type = wdWrapTight
End With

End Sub

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 

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