Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Mon, 21 Apr 2008 07:18:00 -0700,    group: microsoft.public.word.vba.customization        back       


Realign images and text to both side of the document   
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....
date: Mon, 21 Apr 2008 07:18:00 -0700   author:   Brandon M. Hunter

Re: Realign images and text to both side of the document   
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"  wrote in 
message news:FD429626-1B70-46A2-AD9D-D819BF7013D0@microsoft.com...
> 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....
date: Tue, 22 Apr 2008 20:04:02 +1000   author:   Doug Robbins - Word MVP

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us