View Single Post
 
Old 03-15-2018, 06:34 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,343
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your code doesn't make much sense to me.

There's an obvious error with 'End Sub' appearing before 'Option Explicit'.

Then you have a Document_Open macro that selects the 'ColourDropDown' bookmark and then calls an 'Index' macro that tries to populate a variable 'i' with whatever appears in the corresponding formfield's internal bookmark after 'ColourDropDown'. A coding error there means the code falls over that that point. If it worked, 'i' would always be 0, since the formfield's name is the same as the 'ColourDropDown' bookmark itself. So what is the point of the 'i' variable?

If the above worked, you would then have your formfield call the 'ColorDropDown' macro, whose code looks for a formfield named '"DropDown" & i' which, if anything, would always evaluate to 'DropDown0'. But no such formfield exists - the dropdown formfield's name is only ever 'ColourDropDown' and no other formfield with a name like '"DropDown" & i' exists in the document.

Finally, even if you resolve all of the above, your code would set the Dropdown selection's font and background to the same colour, effectively making the text invisible.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote