Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

LinkBack Thread Tools Display Modes
Old 05-13-2019, 02:25 PM
mahaabub mahaabub is offline Windows 10 Office 2013
Join Date: May 2019
Location: Toronto
Posts: 1
mahaabub is on a distinguished road
Default Show/Delete paragraph based on checkbox status


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.

Attached Images
File Type: png VBA Macro.png (82.4 KB, 10 views)
Reply With Quote
Old 05-13-2019, 05:33 PM
gmaxey gmaxey is offline Windows 10 Office 2016
Word MVP 2003-2009
Join Date: May 2010
Location: Marble, NC
Posts: 843
gmaxey will become famous soon enough

Wrap your conditional text is a rich text content control e.g., title it "Kill me"

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
  End If
  Exit Sub
End Sub
Greg Maxey
Please visit my web site at
Reply With Quote

Thread Tools
Display Modes

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 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

All times are GMT -7. The time now is 10:14 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc. is not affiliated with Microsoft