Macro from Text Input box

P

Paul Brown

Hello all,

I'm trying to call a macro based on the input to a text form field. When run
on exit, if the formfield says sterling then run SterlingAccount. If it says
anything else then run CurrencyAccount. The code below is what I've adapted
from calling a macro from a dropdown list. Needless to say it brings up an
error - can anyone offer any guidance?

================================

Dim mydrop
Set mydrop = ActiveDocument.FormFields(1)
If mydrop.TextInput(mydrop.TextInput.Value).Name = "Sterling" Then
Call SterlingAccount

Else
Call CurrencyAccount

End If

=================================

Many thanks.

Paul.
 
H

Helmut Weber

Hi Paul,
I'm trying to call a macro based on the input to a text form field.

I'd say, you are trying to start some code
depending on the result from a dropdownlist formfield.

I wouldn't call what the user selects from the list as input.

As simple and as confusing as that.

Sub Test888888()
' the on exit macro for FormFields(1)
MsgBox ActiveDocument.FormFields(1).Result
End Sub

Which doesn't fire, if the user clicks the next formfield,
only if he uses [TAB] to leave formfield 1, IMHO.

See my recent other posting according "checkbox hidden text".

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
P

Paul Brown

Thanks Helmut - much appreciated

Helmut Weber said:
Hi Paul,
I'm trying to call a macro based on the input to a text form field.

I'd say, you are trying to start some code
depending on the result from a dropdownlist formfield.

I wouldn't call what the user selects from the list as input.

As simple and as confusing as that.

Sub Test888888()
' the on exit macro for FormFields(1)
MsgBox ActiveDocument.FormFields(1).Result
End Sub

Which doesn't fire, if the user clicks the next formfield,
only if he uses [TAB] to leave formfield 1, IMHO.

See my recent other posting according "checkbox hidden text".

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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