Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-10-2014, 04:16 AM
macropod's Avatar
macropod macropod is offline Add text box to each page in a word doc Windows 7 32bit Add text box to each page in a word doc Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can indeed format the page #s with a prefix - and to start at a # other than 1 - but since it appears you need a macro, here's some code to get you started:
Code:
Sub Demo()
Dim i As Long, Rng As Range, Shp As Shape
With ActiveDocument
  For i = 1 To .ComputeStatistics(wdStatisticPages)
    Set Rng = .GoTo(What:=wdGoToPage, Name:=i)
    Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page")
    Rng.Collapse wdCollapseStart
    Set Shp = .Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
      Left:=0, Top:=0, Width:=180, Height:=60, Anchor:=Rng)
    With Shp
      .RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
      .Left = wdShapeLeft
      .RelativeVerticalPosition = wdRelativeVerticalPositionMargin
      .Top = wdShapeTop
      .Fill.Visible = False
      With .TextFrame.TextRange
        .Font.Bold = True
        .Font.ColorIndex = wdBlue
        .Text = "Ref. No.: T" & vbCr & "Signature " & Format(Now, "DDDD, D MMM YYYY")
        Set Rng = .Paragraphs.First.Range
        With Rng
          .Font.ColorIndex = wdRed
          .End = .End - 1
          .Collapse wdCollapseEnd
        End With
        .Fields.Add Range:=Rng, Type:=wdFieldEmpty, Text:="PAGE \# 000", PreserveFormatting:=False
      End With
    End With
  Next
End With
End Sub
As coded, the macro makes the textboxes transparent. If you don't want that, delete '.Fill.Visible = False'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
pages, referencing, text box



Similar Threads
Thread Thread Starter Forum Replies Last Post
Text disappears (but headings and text boxes ok) when printing 1 page of a document msfordummies Word 1 02-21-2013 10:28 PM
Add text box to each page in a word doc Macro to Add Text and Page Number to Top of Each Page Within Text eslight Word VBA 10 12-07-2012 08:18 PM
Add text box to each page in a word doc Selection of all Text for a specific page in word is spanning selection across pages ramsgarla Word VBA 9 12-05-2012 03:23 AM
2 page document printing problem, text from page 1 in layout of page 2 when printed laurawether45 Word 1 08-02-2012 07:03 AM
Add text box to each page in a word doc MS Word, page goes to next page when entering data on previous page munna94 Word 2 12-30-2010 08:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft