Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Seaching for style (97/2000/XP/2004)

    Hi

    I have a following type of document and would like to get to the 'first' heading 1 with the starting number of 1.

    Cover Page
    Change History Page
    TOC Page - with the 'TOC Page Title' set to 'Heading 1' but NO numbering for it.
    1.0 Introduction/Release Info/... (set to 'Heading 1')
    2.0 ... (set to 'Heading 1')
    3.0 ... (Set to 'Heading 1')

    I have recorded macros to search for the 'TOC style' & then 'Heading 1' style but they do not seem to find anything. They fail consistently.

    Basically the question is that 'Is there a simple of finding the starting position of '1.0 Heading'? I have tried using ranges & selection but it still doesn't work.

    Thanks for the info in advance.

    Robie
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Seaching for style (97/2000/XP/2004)

    Does this do what you want? Collapsing the selection after the first Execute is essential.

    Sub Goto1()
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
    .ClearFormatting
    .Text = ""
    .Forward = True
    .Format = True
    .Style = "TOC 1"
    If .Execute Then
    Selection.Collapse Direction:=wdCollapseEnd
    .Style = "Heading 1"
    .Execute
    End If
    End With
    End Sub

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Seaching for style (97/2000/XP/2004)

    Hans my friend a biiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiig thank you <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

    That seems to work great. It's easy when you know how. I must have spent couple of days trying to get this this working - recording/recording macros <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

    THANKS.

    Robie
    Thanks.
    Robie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •