Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2006
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can you do an if statement for a combo box? (word 2007)

    I am creating a template with a dialog box. In the dialog box, I have a combo box that lists 3 items. I want to know if you can make an if statement based on the items in the combo box. For example. If the user chooses the item "member", then go to the bookmark named "status" and type in "Member of the Association". The combo box inserts the value of the combo box in a separate bookmark.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: can you do an if statement for a combo box? (word 2007)

    You can create code for the After Update event of the combo box and use a Select Case statement, e.g.
    <code>
    Private Sub ComboBox1_AfterUpdate()
    Dim rng As Range
    Select Case Me.ComboBox1
    Case "Member"
    ' Code to execute if user selected "Member"
    Set rng = ActiveDocument.Bookmarks("Status").Range
    rng.Text = "Member of the Association"
    'Re-insert the bookmark
    ActiveDocument.Bookmarks.Add "Status", rng
    Case "..."
    ...
    Case "..."
    ...
    End Select
    End Sub
    </code>
    I hope this gives you something to start with

  3. #3
    Lounger
    Join Date
    Mar 2006
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: can you do an if statement for a combo box? (word 2007)

    Thanks a lot. This worked.

Posting Permissions

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