Realign images and text to both side of the document

Realign images and text to both side of the document

Post by QnJhbmRvbi » Tue, 22 Apr 2008 23:18:00

I'm having a trouble aligning my page number text section and my logos to
both side of the document .What I want is that the page numbers and title to
appear on the right side of the document for each footer and the logo to
appear on the left side of the document for each footer in the whole word
document. Below is a sample of my code:
This adds the text to the footer
Set docActive = objWord.ActiveDocument
docActive.ActiveWindow.ActivePane.View.SeekView = 10
objWord.Selection.ParagraphFormat.Alignment = 2
objWord.Selection.TypeParagraph
objWord.Selection.TypeText window.opener.Field_LName.innerText
objWord.Selection.TypeParagraph
objWord.Selection.TypeText "Page "
objWord.Selection.Fields.Add objWord.Selection.Range, 33
docActive.ActiveWindow.ActivePane.View.SeekView =0
With docActive.PageSetup
.DifferentFirstPageHeaderFooter = False
End With
This adds the logo to the document:
docActive.Sections(1).Footers(1).Range.InlineShapes.AddPicture sFileName,
True, True

docActive.Sections(1).Footers(1).Range.InlineShapes(1).LockAspectRatio = -1
docActive.Sections(1).Footers(1).Range.InlineShapes(1).Width = w
docActive.Sections(1).Footers(1).Range.InlineShapes(1).Height = h
docActive.Sections(1).Footers(1).Range.InlineShapes(1).ScaleHeight =
sh
docActive.Sections(1).Footers(1).Range.InlineShapes(1).ScaleWidth = sw

can anyone help? Thank you....

 
 
 

Realign images and text to both side of the document

Post by Doug Robbi » Wed, 23 Apr 2008 19:04:02

The following code clears any tab stops from the footer and then inserts a
right aligned tab stop at the right margin, then inserts a logo at the left
margin and "this is some Text" at the right margin.

Dim j As Long
With ActiveDocument.Sections(1)
With .PageSetup
j = .PageWidth
j = j - .RightMargin
j = j - .LeftMargin
End With
With .Footers(wdHeaderFooterPrimary).Range
With .Paragraphs(1).TabStops
.ClearAll
.Add j, wdAlignTabRight
End With
.InlineShapes.AddPicture "C:\Logo.jpg"
.InsertAfter vbTab & "This is some Text"
End With
End With

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Brandon M. Hunter" < XXXX@XXXXX.COM > wrote in