Discussion:
Steps to write and activate macro in Word 2003
(too old to reply)
TNSanofi
2007-03-13 17:54:09 UTC
Permalink
Folks,

Any step by step for adding a macro into a word 2003 document?

I want to read one Bookmark A and based on this value show in another field
a default value for Bookmark B or text field. Example: The dropdown value
selected is equal to text "NYC", the default value sould be text "SOHO". How
do I get SoHo to show up in Bookmark B or text field? Then if the dropdown
value is changed to "Boise" the default value in the other field would be
default to "Idaho".

thx.
Greg Maxey
2007-03-13 19:03:20 UTC
Permalink
Assuming your have a dropdown field ("Dropdown1") and a text field
("Text1"), copy the following code to a project module in the
document:

Sub OnExitDD1()
Dim oFFs As FormFields
Set oFFs = ActiveDocument.FormFields
Select Case oFFs("Dropdown1").Result
Case "NYC"
oFFs("Text1").Result = "SOHO"
Case "Boise"
oFFs("Text1").Result = "Idaho"
Case Else
'Do Nothing
End Select
End Sub

Unprotect the form, double click the dropdown field and set
"OnExitDD1" to run on exit. Double click the text field and uncheck
"Enabled"

Reprotect and your done.
Post by TNSanofi
Folks,
Any step by step for adding a macro into a word 2003 document?
I want to read one Bookmark A and based on this value show in another field
a default value for Bookmark B or text field. Example: The dropdown value
selected is equal to text "NYC", the default value sould be text "SOHO". How
do I get SoHo to show up in Bookmark B or text field? Then if the dropdown
value is changed to "Boise" the default value in the other field would be
default to "Idaho".
thx.
Continue reading on narkive:
Loading...