I have a set of 6 tables in a password-protected Word document. Each table has a header row, followed by at least one data row. The 6th column of the second (and subsequent) rows has a drop-down form field in it. There is a button above each table that allows the user to add a row to the table. When they do so, the 6th column contains another drop-down.
After the user selects a value in the drop-down and leaves the field, I need to color that cell, based on the selected value. I can set the OnExit value to run a macro I call "HighlightStatus". To get the reference to the cell to change, I am using
Dim ff As Word.FormField
ThisDocument.Unprotect strSheetPassword
Set ff = ThisDocument.FormFields(Selection.Bookmarks(1).Name)
How do I reference the cell that contains this form field?
The other problem is that when I add a row to the table, I need to set the Name of the form field to a unique one, so that I can reference the field that was just updated. But the Name property seems to be read-only.
I took another approach, that basically runs into the same wall. After updating the field, I had the code loop through all the tables and all of the rows, and update the 6th column of each row. The problem is that the screen scrolls down to the end of the document. To get back to where I was, I still need to uniquely reference the correct form field, which I can't do if the field doesn't have a unique name.