Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2016, 11:42 PM
Guessed's Avatar
Guessed Guessed is offline Word 2010 the requested member of the collection does not exist Windows 10 Word 2010 the requested member of the collection does not exist Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,159
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I think you only need one macro


Code:
Sub ColorDropDown()
  Dim sText As String, oFld As FormField
  With ActiveDocument
    If .ProtectionType <> wdNoProtection Then .Unprotect Password:=""
    For Each oFld In .FormFields
      Select Case oFld.Result
        Case "G"
          oFld.Range.Font.Color = wdColorBrightGreen
          oFld.Range.Shading.BackgroundPatternColor = wdColorBrightGreen
        Case "Y"
          oFld.Range.Font.Color = wdColorYellow
          oFld.Range.Shading.BackgroundPatternColor = wdColorYellow
        Case "R"
          oFld.Range.Font.Color = wdColorRed
          oFld.Range.Shading.BackgroundPatternColor = wdColorRed
      End Select
    Next oFld
    .Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
  End With
End Sub
If your document has other formfields in it then you might need the code to restrict itself to a defined range (bookmarked) or something similar but you don't need to know every named formfield.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 08-02-2016, 12:49 AM
ninaiva ninaiva is offline Word 2010 the requested member of the collection does not exist Windows 7 64bit Word 2010 the requested member of the collection does not exist Office 2016
Novice
 
Join Date: Jul 2016
Posts: 5
ninaiva is on a distinguished road
Default

Wow, it works! Also on the document I am working on. I can't thank you enough!

Another thing - the options change colors only after I run the macro which is not ideal for me. I will be sending this document to people (I am doing a psychological research) so I was wishing that the colors of the options would change while people are picking differnet options. I can't ask them to run a macro after they've made their decision. Is that even possible?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
vba error method or data member not found in excel 2010 Rose roon Excel Programming 0 09-08-2015 03:51 AM
5941 requested member of collection does not exist Prevents Userform from Showing marksm33 Word VBA 1 02-22-2014 08:56 AM
Outlook 2010 problem (new member) Cullers Outlook 0 01-21-2011 10:18 AM
[PowerPoint 2010] Change font for all slides in an exist *.PPTX file LongTTH PowerPoint 0 12-15-2010 02:07 AM
Word 2010 the requested member of the collection does not exist Pack and Go: Does it Exist in PPT 2010? tatihulot PowerPoint 1 11-16-2010 08:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft