fsupport1600
MIS
I have a Word template that opens up a fill-in form for user to complete. The form has a series of text fields and about 9 check boxes. I am having trouble figuring out the vb code so when one of the check boxes is checked, and the "OK" button is clicked, the checkbox that appears on the word document are then checked.
Checkboxes have bookmarks assigned to them, checkbox1 - checkbox9. I am assuming an IF/THEN statement is what I need but I am unable to get it to work correctly.
The input fields for the text work great, I just need to get the checkboxes to work.
Any help is appreciated.
Private Sub cmdOK_Click()
If checkbox1 = True Then checkbox1 = True
If checkbox2 = True Then checkbox2 = True
If checkbox3 = True Then checkbox3 = True
If checkbox4 = True Then checkbox4 = True
If checkbox5 = True Then checkbox5 = True
If checkbox6 = True Then checkbox6 = True
If checkbox7 = True Then checkbox7 = True
If checkbox8 = True Then checkbox8 = True
If checkbox9 = True Then checkbox9 = True
End If
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("Date").Range.Text = txtDate.Value
.Bookmarks("Company").Range.Text = txtCompany.Value
.Bookmarks("Attn").Range.Text = txtAttn.Value
.Bookmarks("CC").Range.Text = txtCC.Value
.Bookmarks("ProjectNumber").Range.Text = txtProjectNumber.Value
.Bookmarks("SentBy").Range.Text = txtSentBy.Value
End With
Application.ScreenUpdating = True
Unload Me
End Sub
Checkboxes have bookmarks assigned to them, checkbox1 - checkbox9. I am assuming an IF/THEN statement is what I need but I am unable to get it to work correctly.
The input fields for the text work great, I just need to get the checkboxes to work.
Any help is appreciated.
Private Sub cmdOK_Click()
If checkbox1 = True Then checkbox1 = True
If checkbox2 = True Then checkbox2 = True
If checkbox3 = True Then checkbox3 = True
If checkbox4 = True Then checkbox4 = True
If checkbox5 = True Then checkbox5 = True
If checkbox6 = True Then checkbox6 = True
If checkbox7 = True Then checkbox7 = True
If checkbox8 = True Then checkbox8 = True
If checkbox9 = True Then checkbox9 = True
End If
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("Date").Range.Text = txtDate.Value
.Bookmarks("Company").Range.Text = txtCompany.Value
.Bookmarks("Attn").Range.Text = txtAttn.Value
.Bookmarks("CC").Range.Text = txtCC.Value
.Bookmarks("ProjectNumber").Range.Text = txtProjectNumber.Value
.Bookmarks("SentBy").Range.Text = txtSentBy.Value
End With
Application.ScreenUpdating = True
Unload Me
End Sub