I need to combine two Word 2010 macros
I have two macros:
- One that is a simple paste from the clipboard
- The other takes a selected graphic in a document, right aligns it with the column and sets the Text Wrap to "tight".
What I would like is one macro that would paste and align the graphic. Currently, the second macro requires that the item be selected first and I don't know how to do that in VBA. Perhaps there's a simpler way to just apply the attributes I need at the point of pasting the graphic.
Here's what I have currently:
Sub PasteInline()
'
' PasteInline Macro
'
'
Selection.PasteSpecial Placement:=wdInLine
End Sub
Sub RightAlignGraphic()
'
' RightAlignGraphic Macro
'
'
Dim myShape As Shape
If Selection.InlineShapes.Count > 0 Then
Set myShape = Selection.InlineShapes(1).ConvertToShape
ElseIf Selection.ShapeRange.Count > 0 Then
Set myShape = Selection.ShapeRange(1)
Else
MsgBox "Please select a picture first."
Exit Sub
End If
With myShape
.WrapFormat.Type = wdWrapTight
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = wdShapeRight
End With
End Sub
I would greatly appreciate any assistance with combining the functionality of these two macros.
Thanks
Brian
|