PDA

View Full Version : Create a dropbox to hide/show text



thamgrace
07-17-2014, 07:53 PM
hi, I trying to create a dropdown box in word doc which can hide/show my bookmarked text. anyone can help?
I can create via the checkbox (hide/unhide) but can't do it for dropdown.

mart.potter
07-24-2014, 12:38 AM
hide/show my bookmarked text
what text is that?

where would you like to place this dropdown? to the ribbon or to the form? if to the ribbon you need to create a Visual Studio addin for that, if thru form them Visual Basic editor.

macropod
07-24-2014, 05:08 AM
What kind of 'dropbox' are you using and how are you doing this via a checkbox?

thamgrace
07-28-2014, 07:04 PM
hi, want to create a combo box macro to control the visibility of my text. anyway, I managed to do it using vba script. thanks!

aggiefox
05-20-2015, 12:57 PM
thamgrace,

I am trying to do the same thing, how did you end up solving this? Any help is much appreciated.

thamgrace
05-20-2015, 06:37 PM
create a drop down list with variables "A" and "B"
create your text and book marked as "A" and "B"

---
Private Sub ComboBox1_DropButtonClick()
ComboBox1.List = Array("A", "B")
End Sub
Private Sub ComboBox1_change()
Call ShowHideBookmark
End Sub
Sub ShowHideBookmark()
Dim orange As Range
Set orange = ActiveDocument.Bookmarks("A").Range
Set apple = ActiveDocument.Bookmarks("B").Range

If ComboBox1.Value = "B" Then
With orange.Font
.Hidden = True
End With
With apple.Font
.Hidden = False
End With

ElseIf ComboBox1.Value = "A" Then
With orange.Font
.Hidden = False
End With
With apple.Font
.Hidden = True
End With
End If
End Sub

aggiefox
05-21-2015, 09:12 AM
Thamgrace,

Thanks! worked perfect!