I have created a form that allows the user to create a report document. The user clicks "Print Report" from the "File" menu and a MS Word document opens up with the information they want to display. I created a mock form with three text fields: First Name, Middle Name, and Last Name. Beside those fields I have a checkbox. I want the user to be able to select which fields they want to show on the report. Below is the code I'm using for my conditional statement:
If First_Name_Check.Checked Then
With oWord.ActiveDocument.Sections.Item(1)
.Range.Font.Color = Word.WdColor.wdColorBlack
.Range.Text = "First Name: " & First_Name.Text
End With
End If
If Last_Name_Check.Checked Then
With oWord.ActiveDocument.Sections.Item(1)
.Range.Font.Color = Word.WdColor.wdColorBlack
.Range.Text = "Last Name: " & Last_Name.Text
End With
End If
The problem is that if I select both checkboxes, when I click "Print Report," only the last name information displays instead of both fields. What am I doing wrong?????
Enter your message below
Sign in or Join us (it's free).