Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-15-2022, 06:55 PM
dohertym dohertym is offline UserForm with checkboxes that hide/show bookmarked text in document Windows 10 UserForm with checkboxes that hide/show bookmarked text in document Office 2021
Novice
UserForm with checkboxes that hide/show bookmarked text in document
 
Join Date: May 2022
Posts: 6
dohertym is on a distinguished road
Default UserForm with checkboxes that hide/show bookmarked text in document

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.)
Attached Files
File Type: docx DocuForm images.docx (126.7 KB, 17 views)
Reply With Quote
 

Tags
checkbox, show, userform



Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Userform hide active document only Just Learning Word VBA 4 03-25-2020 08:57 PM
UserForm with checkboxes that hide/show bookmarked text in document Auto-populating a document pulling data from external doc using a Userform with Checkboxes kateabode Word VBA 10 10-12-2018 06:56 AM
UserForm with checkboxes that hide/show bookmarked text in document How to use checkbox to show/hide bookmarked text? 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
UserForm with checkboxes that hide/show bookmarked text in document Show userform without losing document focus? Or other method to get a graphic to pop? AlexR Word VBA 7 03-31-2013 12:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft