![]() |
#1
|
|||
|
|||
![]()
Hi,
I am very new to UserForms (control fields, VBA, etc.) I have created a UserForm for a document with a number of text fields and then three checkboxes. The intention of the three checkboxes is to link each one to different bookmarked text within the document. The text needs to be shown/hidden depending on whether or not the checkbox is checked. My userform has a 'submit' button. I have got the code for filling the text fields and it's working great. I'm stuck on how to structure the If statements. Below is a copy of my code for the 'submit' button on my userform. Private Sub SubmitButton_Click() Dim Participant As Range Set Participant = ActiveDocument.Bookmarks("Participant").Range Participant.Text = Me.ParticipantName.Value Dim DateofBirth As Range Set DateofBirth = ActiveDocument.Bookmarks("DateofBirth").Range DateofBirth.Text = Me.DOBText.Value Dim NDISnumber As Range Set NDISnumber = ActiveDocument.Bookmarks("NDISnumber").Range NDISnumber.Text = Me.NDISText.Value Dim ClientNominee As Range Set ClientNominee = ActiveDocument.Bookmarks("ClientNominee").Range ClientNominee.Text = Me.ClientText.Value Dim EffectiveStartDate As Range Set EffectiveStartDate = ActiveDocument.Bookmarks("EffectiveStartDate").Ran ge EffectiveStartDate.Text = Me.EffectiveText.Value Dim EffectiveEndDate As Range Set EffectiveEndDate = ActiveDocument.Bookmarks("EffectiveEndDate").Range EffectiveEndDate.Text = Me.UntilText.Value If ContinenceCB Then ActiveDocument.Bookmarks("ContinenceCost") = True Else: ActiveDocument.Bookmarks("ContinenceCost") = True Me.Repaint UserForm1.Hide I know that the If statement above is incorrect. I've attached a word document that better explains what I need to show in the completed document - based on checkbox selection. Any help with this is greatly appreciated. PS (Sorry if the If statement is total rubish. I'm quite confused at the moment.) |
Tags |
checkbox, show, userform |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Show Userform hide active document only | Just Learning | Word VBA | 4 | 03-25-2020 08:57 PM |
![]() |
kateabode | Word VBA | 10 | 10-12-2018 06:56 AM |
![]() |
namrehx | Word VBA | 16 | 12-14-2017 01:45 PM |
How to use checkbox to show and hide bookmarked text? | namrehx | Word VBA | 1 | 12-12-2017 02:17 PM |
![]() |
AlexR | Word VBA | 7 | 03-31-2013 12:17 PM |