babsiee
12-19-2013, 05:28 AM
With my macro I attach a full size a4 image in the header of my file. It goes well but when I type it does not what I would like to.
If I write a sentence in my document the first rule goes fine, but if my text is longer then it continues writing on a second page. So I cannot type more then 1 rule. When I manually wrap the image behind the text it goes find.
I would like to have the image to be wrapped behind the text. How do I include this in my macro?
Any ideas would be highly appreciated.
This is the code I use:
Sub attachimage_clicktwee()
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Dim oDialog As Word.Dialog
' \\ Get a handle to the Insert picture dialog
Set oDialog = Dialogs(wdDialogInsertPicture)
' \\ Work with dialog
With oDialog
' \\ Display the dialog
.Display
' \\Insert Shape Picture if the Name property (Filepath) <> ""
' \\ Set Left, Top, Width and Height properties to position the shape
If .Name <> "" Then
ActiveDocument.Shapes.AddPicture FileName:=.Name, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Left:=370, _
Top:=-90, _
Width:=595, _
Height:=842, _
Anchor:=Selection.Range
FloatBehindText = True
End If
End With
' \\ Clean up
Set oDialog = Nothing
End Sub
If I write a sentence in my document the first rule goes fine, but if my text is longer then it continues writing on a second page. So I cannot type more then 1 rule. When I manually wrap the image behind the text it goes find.
I would like to have the image to be wrapped behind the text. How do I include this in my macro?
Any ideas would be highly appreciated.
This is the code I use:
Sub attachimage_clicktwee()
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Dim oDialog As Word.Dialog
' \\ Get a handle to the Insert picture dialog
Set oDialog = Dialogs(wdDialogInsertPicture)
' \\ Work with dialog
With oDialog
' \\ Display the dialog
.Display
' \\Insert Shape Picture if the Name property (Filepath) <> ""
' \\ Set Left, Top, Width and Height properties to position the shape
If .Name <> "" Then
ActiveDocument.Shapes.AddPicture FileName:=.Name, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Left:=370, _
Top:=-90, _
Width:=595, _
Height:=842, _
Anchor:=Selection.Range
FloatBehindText = True
End If
End With
' \\ Clean up
Set oDialog = Nothing
End Sub