Results 1 to 4 of 4

Thread: Checking if a content control combo box value is a number between x and y

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,411
    Location
    Anarxo,

    As an alternative to the CC Exit event Graham shows, you can use the following event to do something similar:

    Private Sub Document_ContentControlBeforeContentUpdate(ByVal ContentControl As ContentControl, Content As String)
    Dim oCC As ContentControl
      Select Case ContentControl.Tag
        Case Is = "score combo box"
          Select Case Content
            Case Is = "Choose an item."
              ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:classification_combo_box[1]").Text = ""
              Content = ""
            Case Is < 55
              ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:classification_combo_box[1]").Text = "average"
            Case Is < 59
              ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:classification_combo_box[1]").Text = "mildly elevated"
            Case Is < 69
              ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:classification_combo_box[1]").Text = "moderately elevated"
            Case Else
              ContentControl.XMLMapping.CustomXMLPart.SelectSingleNode("/ns0:CC_Map_Root[1]/ns0:classification_combo_box[1]").Text = "extremely elevated"
          End Select
        Case Else
      End Select
    lbl_Exit:
      Exit Sub
    End Sub
    This technique requires that you map the content controls to a CustomXMLPart which Graham's tool facilitates or you can use mine: https://gregmaxey.com/word_tip_pages...rt_Dialog.html

    I have attached a working example (I did not change the CC titles that Graham used).
    Attached Files Attached Files
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

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