1 Attachment(s)
Want insert a page numbers on a table using cross reference Using Bookmark from ...
Hi all,
I just want insert a page numbers on a table using cross reference and reference type should be Bookmark and insert reference to should be Page numbers. The bookmark should be selected from the adjacent cell hyperlink.
The page numbers should be field type. so that it will be updated automatically.
Pls refer the attached Document for details and sample.
Thanks!
CS.
Re: Want insert a page numbers on a table using cross reference Using Bookmark from .
try this one
VB Code:
Dim t As Table
Set t = ActiveDocument.tables(1)
For i = 2 To t.Rows.Count
If Not t.Cell(i, 1).Range.Hyperlinks.Count = 0 Then
b = t.Cell(i, 1).Range.Hyperlinks(1).Name
t.Cell(i, 3).Select
Selection.Collapse Direction:=wdCollapseStart
Selection.InsertCrossReference ReferenceType:="Bookmark", ReferenceKind:= _
wdPageNumber, ReferenceItem:=b, InsertAsHyperlink:=True, _
IncludePosition:=False
End If
Next
pete
edit: your sample show the 3rd column as centre aligned, to do tha add this to the end of above code
VB Code:
t.Columns(3).Select
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter