![]() |
#4
|
||||
|
||||
![]()
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] |
Tags |
heading numbering, search, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
cheech1981 | Word | 9 | 01-11-2017 02:14 AM |
![]() |
pemartins | Excel | 16 | 02-24-2014 11:39 PM |
![]() |
SteveWcg | Word | 5 | 01-08-2014 10:37 PM |
![]() |
ubns | Word VBA | 44 | 09-04-2012 08:17 PM |
![]() |
rossi45 | Word | 2 | 05-04-2012 06:03 PM |