L
Larry Lutz
I need to set up a macro that will always add a picture as a floating shape
anchored to the current paragraph (where the cursor is located at the time
the function executes). The picture would always be the same file in the
same location. For the life of me, I can't figure out how to do it using the
Help on VBA in Word. I'm currently using Word 2003, but I need for this
macro to work in Word 2000.
The following code is as close as I could get, but it obviously doesn't
accomplish the part about anchoring to the current paragraph:
Dim myPicture As Shape
With ActiveDocument.Shapes
Set myPicture = .AddPicture("E:\Documents and Settings\My
Documents\My Pictures\test.jpg", _
Linktofile = False, Savewithdcoument = True)
With myPicture.WrapFormat
.Type = wdWrapSquare
.Side = wdWrapRight
End With
ActiveDocument.Shapes("myPicture").Anchor.Paragraphs(1).Range.Select
End With
Any help will be most appreciated.
Larry
anchored to the current paragraph (where the cursor is located at the time
the function executes). The picture would always be the same file in the
same location. For the life of me, I can't figure out how to do it using the
Help on VBA in Word. I'm currently using Word 2003, but I need for this
macro to work in Word 2000.
The following code is as close as I could get, but it obviously doesn't
accomplish the part about anchoring to the current paragraph:
Dim myPicture As Shape
With ActiveDocument.Shapes
Set myPicture = .AddPicture("E:\Documents and Settings\My
Documents\My Pictures\test.jpg", _
Linktofile = False, Savewithdcoument = True)
With myPicture.WrapFormat
.Type = wdWrapSquare
.Side = wdWrapRight
End With
ActiveDocument.Shapes("myPicture").Anchor.Paragraphs(1).Range.Select
End With
Any help will be most appreciated.
Larry