carnahant
05-17-2017, 09:25 AM
I am looking for a solution to a repetitive task I have to perform. I find myself constantly having to manually set the wrapformat to "Top and Bottom" and set the AllowOverlap to false to achieve my goal.
I tried some code that I thought would work, but there is a problem:
Sub Picture_Wrap()
Dim myPicture As Word.Shape
Set myPicture = Selection.ShapeRange(1)
With myPicture.WrapFormat
.Type = wdWrapTopBottom
.AllowOverlap = False
End With
End Sub
Execution gets to the "Set myPicture" line and throws the following error:
Invalid procedure call or argument
Before I execute, I select and put the focus on the picture I pasted into the document.
Any help would be appreciated.
Thanks,
Tom
I tried some code that I thought would work, but there is a problem:
Sub Picture_Wrap()
Dim myPicture As Word.Shape
Set myPicture = Selection.ShapeRange(1)
With myPicture.WrapFormat
.Type = wdWrapTopBottom
.AllowOverlap = False
End With
End Sub
Execution gets to the "Set myPicture" line and throws the following error:
Invalid procedure call or argument
Before I execute, I select and put the focus on the picture I pasted into the document.
Any help would be appreciated.
Thanks,
Tom