Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Sydney Australia, New South Wales, Australia
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding the page center (Word 2000)

    I am trying to place some text into headers and footers automaticaly
    I can get the text in OK but I need to know how I can position it center and right regardless of the page size or orientation.
    I need to place tabs at the center and right to do this but I can't even read the page width ie.
    PgWidth=ActiveDocument.PageSetup.PageWidth returns 9999999 points !@#$#@!%^
    I can't seem to read the page width
    What on earth am I doing wrong.

    Any Help would be greatly appreciated.

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding the page center (Word 2000)

    Something like this might be a little less painful:

    activedocument.StoryRanges(wdPrimaryHeaderStory).P aragraphFormat.Alignment = wdAlignParagraphCenter
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Finding the page center (Word 2000)

    99999999 is Word's way of indicating that there is more than one value, and therefore the test is indeterminate. Reformulating your test to refer to a specific section should return a valid value, since there cannot be multiple PageWidth values for a single section.

    For example: Selection.Sections(1).PageSetup.PageWidth

  4. #4
    Star Lounger
    Join Date
    Apr 2002
    Location
    Sydney Australia, New South Wales, Australia
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding the page center (Word 2000)

    Thanks
    That explained it and I was able to fix the problem.

    But now I have struck another snag
    I can't seem to put the autotext entry Page X of Y" in the footer
    I am using the following
    PgNumbers=NormalTemplate.AutoTextEntries("Page X of Y").value

    SectX.Footers(wdHeaderFooterPrimary).Range.Text=Pa thFile & vbTab & UName & vbTab & PgNumbers

    SextX is the footer PathFile and UName are text variables

    PgNumbers appears in the footer as

    Page *PAGE* of *NUMPAGES*

    These are not field codes

    How can the method above to insert the Field Codes ?
    Or is there another way ?

    Thanks Again

  5. #5
    Star Lounger
    Join Date
    Apr 2002
    Location
    Sydney Australia, New South Wales, Australia
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding the page center (Word 2000)

    Thanks for the help but I was looking for a method of finding the center of the page rather than centering the paragraph
    Jefferson Scher
    Has provided me with the answer.
    I do have another problem I have explained in my reply to Jeff
    Maybe you have the answer

    Thanks again

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Finding the page center (Word 2000)

    To insert AutoText, you need to use its own methods; you can't assign it to a variable. Instead of this:

    <pre>PgNumbers=NormalTemplate.AutoTextEntries("Pag e X of Y").value
    SectX.Footers(wdHeaderFooterPrimary).Range.Text=Pa thFile & vbTab & UName & vbTab & _
    PgNumbers</pre>

    Try this:

    <pre>SectX.Footers(wdHeaderFooterPrimary).Range.Te xt=PathFile & vbTab & UName & vbTab
    Dim rngAT As Range
    Set rngAT = SectX.Footers(wdHeaderFooterPrimary).Range
    rngAT.Collapse Direction:=wdCollapseEnd
    NormalTemplate.AutoTextEntries("Page X of Y").Insert Where:=rngAT, RichText:=True</pre>

    Seems rather inefficient to have to create this new object. Reversing the sequence would be better:

    <pre>NormalTemplate.AutoTextEntries("Page X of Y").Insert _
    Where:=SectX.Footers(wdHeaderFooterPrimary).Range, RichText:=True
    SectX.Footers(wdHeaderFooterPrimary).Range.InsertB efore PathFile & vbTab & UName & vbTab</pre>

    Hope this helps.

  7. #7
    Star Lounger
    Join Date
    Apr 2002
    Location
    Sydney Australia, New South Wales, Australia
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding the page center (Word 2000)

    Thanks
    That worked well

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •