View Single Post
 
Old 01-29-2015, 08:58 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Since you know the number (which I assume is part of the heading text), you could use Find in VBA to find that number in the relevant Heading Style. For example:
Code:
Dim wdDoc As Document, StrFnd As String
'insert the code that references the document here
StrFnd = "string from database"
With wdDoc.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Format = True
    .Forward = True
    .Wrap = wdFindContinue
    .MatchWholeWord = True
    .Text = StrFnd
    .Style = "Heading 1"
    .Replacement.Text = ""
    .Execute
  End With
  If .Find.Found = True Then
    'do something with the heading
  End If
End With
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote