Remove a section using chkbox

A

Anauna

Hello, (very new to VBA)

I have a form with textboxes linked to bookmarks in a word template. My
last item to figure out is coding a couple of check boxes.

I am having difficutly figuring out the code that when a check box is
selected a section (i.e. sec 4) is removed from the word document. If the
checkbox is unselected the section is left alone.
This will take place under a command button.
 
H

Helmut Weber

Hi Anauna,

do you mean something like this?

Private Sub CommandButton1_Click()

If Me.CheckBox1.Value = True Then
ActiveDocument.Sections(2).Range.Select ' for testing
ActiveDocument.Sections(2).Range.Delete
End If

End Sub

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
Top