I have just checked the file I sent to you and I can see the macro and the code when I open it and go to the developer tab and macros.
Please see a copy and paste of what I see.
End Sub
Option Explicit
Dim i As Long
Private Sub Document_Open()
ActiveDocument.Bookmarks("ColourDropDown").Range.S elect
Call Index
End Sub
Sub Index()
i = Replace(Selection.FormFields(1).Range.Bookmarks(1) .Name, "ColourDropDown", "")
End Sub
Sub ColorDropDown()
Dim sText As String, oFld As FormField
With ActiveDocument
Set oFld = .FormFields("Dropdown" & i)
sText = oFld.Result
If .ProtectionType <> wdNoProtection Then .Unprotect Password:=""
With oFld.Range
Select Case sText
Case Is = "SOP UPDATE" 'green
.Font.Color = wdColorBrightGreen
.Shading.BackgroundPatternColor = wdColorBrightGreen
Case Is = "SAFETY NOTICE" 'yellow
.Font.Color = wdColorYellow
.Shading.BackgroundPatternColor = wdColorYellow
Case Is = "TRAINING UPDATE" 'pink
.Font.Color = wdColorRed
.Shading.BackgroundPatternColor = wdColorRed
Case Is = "ADVISORY BULLETIN" 'grey
.Font.Color = wdColorRed
.Shading.BackgroundPatternColor = wdColorRed
End Select
End With
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End With
End Sub
|