I have office 2007 pro and I need to know how to make a 5 color combo box(Red, Orange Green, Grey, Light Blue), It is simple in excel but I need this to be for a cell in a word doc
I have office 2007 pro and I need to know how to make a 5 color combo box(Red, Orange Green, Grey, Light Blue), It is simple in excel but I need this to be for a cell in a word doc
Here is how to have a word doc using dropdown FormFields
Thanks to macropod
Here's some code based on the idea of using a dropdown formfield in a table. It colours the cell in which the formfield is located. There are two code blocks: Code: Private Sub Document_Open() Call GetFFRef End Sub in the document's 'ThisDocument' module and Code: Option Explicit Dim tCol As Integer, tRow As Integer, fFld As String
Sub ColourIt() Dim Pwd As String, Tint Pwd = "" With ActiveDocument .Unprotect (Pwd) Select Case .FormFields(fFld).Result Case "One" Tint = 3 Case "Two" Tint = 6 Case "Three" Tint = 9 Case "Four" Tint = 12 Case "Five" Tint = 15 End Select .Tables(1).Cell(tRow, tCol).Range.Shading.BackgroundPatternColorIndex = Tint .Protect wdAllowOnlyFormFields, Noreset:=True, Password:=Pwd End With End Sub Sub GetFFRef() With Selection.Cells(1) fFld = .Range.FormFields(1).Name tCol = .ColumnIndex tRow = .RowIndex End With End Sub in a general module.
The dropdown formfield should have a bookmark name, the options 'One' through 'Five' as the dropdown selections, 'GetFFRef' as the 'On Entry' macro and 'ColourIt' as the 'On Exit' macro. If your document has a forms password, add the password between the double-quotes in Pwd = "".
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.