#1
|
|||
|
|||
Show/Delete paragraph based on checkbox status
Hi,
I am trying to automate an employment contract. One of the specification is that for some employment positions, the contract needs to specify 1-2 extra items. So, I need to code a checkbox to either show these paragraphs or delete them (see attachment). If the paragraphs are not needed, then the bullet points need to be rearranged so that there are no space, and the numbering continues. So, in the picture, if the check box was not selected, i need to see only 3 paragraphs numbered a, b, c. I have tried to use show/hide text using activex checkbox. It did not solve the numbering issue. also, when i use hide text, it leaves blank space where the paragraphs are hidden. Any help would be very much appreciated. Thank you. Mahabub |
#2
|
|||
|
|||
Wrap your conditional text is a rich text content control e.g., title it "Kill me"
Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim bCheck As Boolean Dim oRng As Range bCheck = False 'Simulates your check box unchecked state. If Not bCheck Then Set oRng = ActiveDocument.SelectContentControlsByTitle("Kill me").Item(1).Range.Paragraphs(1).Range ActiveDocument.SelectContentControlsByTitle("Kill me").Item(1).Delete True oRng.Delete End If lbl_Exit: Exit Sub End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Apply a formula or not depending on checkbox status | 14spar15 | Excel | 1 | 10-12-2018 01:14 PM |
Bookmark will not show/hide based on CC Checkbox | lord_kaiser | Word VBA | 1 | 04-17-2018 01:19 AM |
Hide/Show text based upon check box status | nathan.gray@emerson.com | Word VBA | 5 | 12-08-2017 01:08 PM |
Show current section in status bar | Phil H | Word | 2 | 02-02-2016 01:45 PM |
Show/Hide Text based on Checkbox Selection | tammytran105 | Word VBA | 7 | 10-02-2014 04:30 PM |