E
Ed
This loop works - but it stays in one place and doesn't move forward through
the document. What simple silly thing have I forgotten?
With doc.Content.Find
.ClearFormatting
.Style = "TOCpageref"
.Wrap = wdFindContinue
Do While .Execute(Forward:=True, _
Format:=True) = True
Selection.Collapse wdCollapseStart
Set fldPgNo = doc.Fields.Add(Range:=Selection.Range, _
Type:=wdFieldPage)
strPgNo = fldPgNo.Result
fldPgNo.Delete
MsgBox strPgNo
Loop
End With
the document. What simple silly thing have I forgotten?
With doc.Content.Find
.ClearFormatting
.Style = "TOCpageref"
.Wrap = wdFindContinue
Do While .Execute(Forward:=True, _
Format:=True) = True
Selection.Collapse wdCollapseStart
Set fldPgNo = doc.Fields.Add(Range:=Selection.Range, _
Type:=wdFieldPage)
strPgNo = fldPgNo.Result
fldPgNo.Delete
MsgBox strPgNo
Loop
End With