PDA

View Full Version : [SOLVED:] Bullets not being included in selection



MacroWizard
12-13-2015, 02:39 PM
Hello again!

I have a button that places the entire selection range into a rich content control. Now, the contents that are inside of these content controls are supposed to be hidden once another button is pushed. My problem is that the bullets aren't being selected unless there is both text before and after the bullet. I need them to be included given any case. Let me know what you guys think. I have attached pictures below so that you can have a visual of what is going on.


14969

14970

I thank you in advance. Something so simple, yet I can't seem to figure out how to select the bullets in the other two cases.

gmayor
12-14-2015, 11:57 PM
The following will do it, (using the tag from your other question)

Sub HideCC()
Dim occ As ContentControl
Set occ = ActiveDocument.SelectContentControlsByTag("FacilitatorBlock").item(1)
occ.Range.Font.Hidden = True
occ.Range.ListFormat.RemoveNumbers wdBulletGallery
lbl_Exit:
Set occ = Nothing
Exit Sub
End Sub

Sub ShowCC()
Dim occ As ContentControl
Set occ = ActiveDocument.SelectContentControlsByTag("FacilitatorBlock").item(1)
occ.Range.Font.Hidden = False
ListGalleries(wdBulletGallery).ListTemplates(1).Name = ""
occ.Range.ListFormat.ApplyListTemplateWithLevel _
ListTemplate:=ListGalleries(wdBulletGallery).ListTemplates(1), _
ContinuePreviousList:=False, _
ApplyTo:=wdListApplyToWholeList, _
DefaultListBehavior:=wdWord10ListBehavior
lbl_Exit:
Set occ = Nothing
Exit Sub
End Sub