![]() |
|
#1
|
||||
|
||||
![]() Quote:
1. set the page StartingNumber to whatever you want. For example, use: Code:
.Sections(1).Headers(wdHeaderFooterPrimary).PageNumbers.StartingNumber = myref Code:
.Text = "Ref. No.: " & StrPre & (i + myref - 1) & vbCr & "Signature " & Format(Now, "DDDD, D MMM YYYY") Code:
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 Code:
.Paragraphs.First.Range.Font.ColorIndex = wdRed
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Thanks a lot Macropod.
this is almost my final code: Code:
Dim x As Long, Rng As Range, Shp As Shape With ActiveDocument For x = 1 To .ComputeStatistics(wdStatisticPages) Set Rng = .GoTo(What:=wdGoToPage, Name:=x) Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page") Rng.Collapse wdCollapseStart Set Shp = .Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _ Left:=0, Top:=0, Width:=100, Height:=40, Anchor:=Rng) With Shp .RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin .Left = wdShapeRight .RelativeVerticalPosition = wdRelativeVerticalPositionMargin .Top = wdShapeTop .Fill.Visible = False With .TextFrame.TextRange .Font.Bold = True .Font.ColorIndex = wdBlue .Text = AlphaPortion & StrPre & (x + NumPortion) & vbCr & Me.TextBox2.Value & " " & Format(Now, "D MMM YYYY") .ParagraphFormat.SpaceAfter = 0 Set Rng = .Paragraphs.First.Range With Rng .Font.ColorIndex = wdRed .End = .End - 1 .Collapse wdCollapseEnd End With End With End With Next End With End Sub however, there is a small bug for this code, when i run it, it seems it will first add text box to the last page, and then starting from the second page, until the last page again. So the first page won't have any textbox, but the last page would have two, one cover over the other one. Im not sure where did i do wrong? Last edited by macropod; 01-10-2014 at 04:43 PM. Reason: Deleted unnecessary quote of entire post replied to. |
![]() |
Tags |
pages, referencing, text box |
|
![]() |
||||
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 |
![]() |
eslight | Word VBA | 10 | 12-07-2012 08:18 PM |
![]() |
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 |
![]() |
munna94 | Word | 2 | 12-30-2010 08:12 AM |