Selection on page 2

A

Aaron

Hello,

Thank you in advance to the respondent.

What I am doing: A form has checkboxes for items on a
report / headings with a bullet under it. The headings
relating to the checked boxes will be deleted.

The code using .goto works great for the first page and I
have figured out how to get the second page... however
when using wdGotoAbsolute, wdGotoFirst what happens is it
jumps back to the first page. When using wdGotoRelative
it only will work on one item since that item becomes the
relative position, the rest will not work.

Here is the code, one using abosolute and the other not.
My question is how do I get this code to work on the
second page.

..GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=2

If chkPFacility.Value = True Then
MsgBox ("Facility if statement")
.GoTo What:=wdGoToLine, Which:=wdGoToAbsolute,
Count:=6
.ExtendMode = True
.MoveDown Unit:=wdLine, Count:=3
'.Delete
.ExtendMode = False
End If

If chkPGenBus.Value = True Then
MsgBox ("GenBus if statement")
.GoTo What:=wdGoToLine, Which:=wdGoToRelative,
Count:=3
.ExtendMode = True
.MoveDown Unit:=wdLine, Count:=3
'.Delete
.ExtendMode = False
End If

Aaron
 
J

Jezebel

A better approach to this would be to define a bookmark for each of the
headings; then simply delete the bookmark range --

If chkPFacility.Value = True Then
ActiveDocument.Bookmarks("PFacility").Range.Delete
End if

Apart from the simplicity, doing it this way means you can rearrange your
document without having to re-code all your goto statements.
 
A

Aaron

Thank you Jezebel. I will be trying this on Monday. In
the interum is there a way to do what I asked without
bookmarks? I know it is a better way, however as a
beginner that questions is absolutly killing me!
 

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