Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Apr 2009
    Location
    Melbourne, Australia
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Extract value of a content control using VBA in Word

    We have set up some building block content controls in tables (in Word 2010) for the users to select a status (High, Medium, Low).
    We used building blocks rather than dropdown lists so that we could format the values in specific colours.
    Now I want to run a macro that scrolls through the whole document and pulls out information from these many tables and displays a summary elsewhere.
    Most info I can grab but I cannot work out how to get the value of one of these controls from VBA (it returns "/" instead of High/Medium/Low or even a number).
    If I use a dropdown list instead I can get the status value in a macro.

    So can you help me work out what methods to use to get the value of a building block content control?

    Alternatively, can I somehow use conditional formatting - if a dropdown value is "High", make it red, Amber if medium, and green for low?

    thanks,
    Margaret

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,978
    Thanks
    0
    Thanked 208 Times in 189 Posts
    See attached, which uses a dropdown with conditional formatting (I already had this example to hand). As coded, it shades the table cell the dropdown control is in. If you want to shade only the actual content control, simply delete the '.Cells(1)' references.
    Attached Files Attached Files
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. The Following User Says Thank You to macropod For This Useful Post:

    mah34 (2013-10-01)

  4. #3
    New Lounger
    Join Date
    Apr 2009
    Location
    Melbourne, Australia
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks Paul - this is great.

Tags for this Thread

Posting Permissions

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