Consulting

Results 1 to 7 of 7

Thread: Create a dropbox to hide/show text

  1. #1

    Create a dropbox to hide/show text

    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.

  2. #2
    VBAX Regular mart.potter's Avatar
    Joined
    Jul 2014
    Location
    Tallinn, Estonia (EU)
    Posts
    9
    Location
    Quote Originally Posted by thamgrace View Post
    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.

  3. #3
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    What kind of 'dropbox' are you using and how are you doing this via a checkbox?
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    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!

  5. #5
    VBAX Newbie
    Joined
    May 2015
    Posts
    4
    Location
    thamgrace,

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

  6. #6
    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

  7. #7
    VBAX Newbie
    Joined
    May 2015
    Posts
    4
    Location
    Thamgrace,

    Thanks! worked perfect!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •