GoTo Heading with Section Breaks

J

jlp1782

I have a macro written, but I have a small problem.

I need to go to a heading and select the section. The problem is not
the selecting (when there are section breaks, you hit F8 five times and
it selects that section), but it is getting to the next heading. I can
get to heading 1, by doing a
Selection.GoTo What:=wdGoToHeading, Which:=wdWordGoToFirst

However, when I do a wdWordGoToNext, it sends me to the section break
after the heading. How do I get to the next heading without erasing my
section breaks?!?!?!

Thank you!
Jessica
 
C

Cindy M -WordMVP-

Hi Jlp1782,
I need to go to a heading and select the section. The problem is not
the selecting (when there are section breaks, you hit F8 five times and
it selects that section), but it is getting to the next heading. I can
get to heading 1, by doing a
Selection.GoTo What:=wdGoToHeading, Which:=wdWordGoToFirst

However, when I do a wdWordGoToNext, it sends me to the section break
after the heading. How do I get to the next heading without erasing my
section breaks?!?!?!
So, if you were at the end of the first section, the next heading you'd
want would be in the following section? Is this always the Heading 1
style (or another style)?

In that case, I'd think Find/Replace would be the better approach?

Or, if you really like GoTo, see if it helps to specify GoToNext WHAT
What:=wdGoToHeading, Which:=wdGoToNext

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
J

jlp1782

Nevermind, I figured it out!

What I did what, I did a GoTo What:=wdGoToHeading, then I did a Go Down
one line, this way I didn't have to remove the section breaks.

Thank you anyway!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top