From: jkitzy on
I am building a very complex form and need some assistance...

In this form, I use sections to hide/show mulitple repeated sections within
the form. Users click +/- buttons to add (unhide) or delete (clear all fields
and hide) these sections. No problem. Works great.

Within each section, use a scheme to differentiate my fields. Each section
has ~40 fields. One of these is a drop-down field (not activeX) used to make
a choice. Based on the choice, I want several fields to change. It's a form
with rates, so I need different information if Fixed or Variable are chosen
in the drop-down, which I call CR1_RD (the 1 indicates the section).

I want this field to fire off an exit macro to enter different information
into other fields in that section based on its value. I'd like to not
duplicate code for each section by capturing the field name that fires the
exit macro.

The only missing piece in my brain for this is, on an exit macro, how do I
capture the section number or field name that fired it?

Thanks!

--
--jkitzy
From: Greg Maxey on
Sub DDOnExit()
MsgBox "Section: " & Selection.Information(wdActiveEndSectionNumber) & _
" " & Selection.FormFields(1).Name
End Sub




jkitzy wrote:
> I am building a very complex form and need some assistance...
>
> In this form, I use sections to hide/show mulitple repeated sections
> within the form. Users click +/- buttons to add (unhide) or delete
> (clear all fields and hide) these sections. No problem. Works great.
>
> Within each section, use a scheme to differentiate my fields. Each
> section has ~40 fields. One of these is a drop-down field (not
> activeX) used to make a choice. Based on the choice, I want several
> fields to change. It's a form with rates, so I need different
> information if Fixed or Variable are chosen in the drop-down, which I
> call CR1_RD (the 1 indicates the section).
>
> I want this field to fire off an exit macro to enter different
> information into other fields in that section based on its value. I'd
> like to not duplicate code for each section by capturing the field
> name that fires the exit macro.
>
> The only missing piece in my brain for this is, on an exit macro, how
> do I capture the section number or field name that fired it?
>
> Thanks!