Find and replace Drop-Down's on form

C

Chris Joyce

Hi,

I've been tryting to find a way to find all drop-down form fields in a
document and change there format . based on the value entered ?

eg if the value is a 'tick' ( in windings) then leave it alone , but if its
value is '10' chen change the font to 'Times New Roman'

All the data has been entered on the form's so I can't use a onexit() macro
:-(


Chris
 
D

DA

Hi Chris

I'm not aware of a collection being available for drop
downs, so you'll have to cycle through each form field
and then test it to see if it is a drop-down.

For example
-----------
Sub DropDownChange()
Dim lngfidx As Long
Dim fTest As DropDown

With ActiveDocument
For lngfidx = 1 To .FormFields.Count
Set fTest = .FormFields(lngfidx).DropDown
If fTest.Valid = True Then
'place your other logic here. For example:
'[If fTest.Value = 10 Then _] or;
'[If fTest.ListEntries(1).Name = "10" Then _]
.FormFields(lngfidx).Range.Font.Name _
= "Times New Roman"
End If
Next lngfidx
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top