Thank you so much. The code works perfectly. I just wanted to be sure I
understood what it was doing.
Elaine
"Doug Robbins - Word MVP" wrote:
> Sections.Count will give the number of sections in the document, so
> Sections(Section.Count) refers to the last section in the document. The
> cursor does not have to be in that section.
>
> As an example, if there were 5 sections in the document, Sections.Count
> would return 5 so that Section(Sections.Count) would be the equivalent of
> Sections(5)
>
> If you wanted the Section in which the cursor is located,
> Selection.Sections(1) would give you the section in which the start of the
> text selected by the cursor is located.
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "Elaine J."
> news:DB97218F-64BF-4228-AD30-A45AD83F84E0@microsoft.com...
> > Helmut, thank you so much. I understand all of it except this line of
> > code:
> >
> > Set rTmp = .Sections(.Sections.Count).Range
> >
> > What does that do? Is it the last section of the document? Or do I have
> > to
> > have my cursor in that section first?
> >
> > Thanks again for your help.
> >
> > "Helmut Weber" wrote:
> >
> >> Hi Elaine,
> >>
> >> like that:
> >>
> >> Sub Scratchmacro()
> >> Dim rTmp As Range
> >> With ActiveDocument
> >> Set rTmp = .Sections(.Sections.Count).Range
> >> rTmp.Tables(2).Rows(4).Delete
> >> rTmp.Tables(2).Rows(3).Delete
> >> With rTmp.Find
> >> .Text = "SomeText"
> >> If .Execute Then
> >> rTmp.InsertBefore "SomeMoreText"
> >> End If
> >> End With
> >> End With
> >> End Sub
> >>
> >> --
> >>
> >> Greetings from Bavaria, Germany
> >>
> >> Helmut Weber, MVP WordVBA
> >>
> >> Vista Small Business, Office XP
> >>
>
>
>