Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2019, 05:33 PM
gmaxey gmaxey is offline Show/Delete paragraph based on checkbox status Windows 10 Show/Delete paragraph based on checkbox status Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply



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
Show/Delete paragraph based on checkbox status Hide/Show text based upon check box status nathan.gray@emerson.com Word VBA 5 12-08-2017 01:08 PM
Show/Delete paragraph based on checkbox status Show current section in status bar Phil H Word 2 02-02-2016 01:45 PM
Show/Delete paragraph based on checkbox status Show/Hide Text based on Checkbox Selection tammytran105 Word VBA 7 10-02-2014 04:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:31 AM.


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