Automation in Word

T

Tonto

I would like to automate a letter in Word 2003 so that when a field
value is entered in it, the letter automatically enters three other
vaules elsewhere in the letter?



If then and and

£50 £20 £20 £10

£60 £20 £20 £20

£75 £25 £25 £25

£80 £30 £30 £20



For example if the entered value is £50 then the other three vaulues
will be £20 £20 and £10.

It would also be helpful if you could suggest how to do this with
dates?

I hope you can make a suggestion.

Thanks

John
 
D

Doug Robbins - Word MVP

If you were using formfields, with the first formfield having the bookmark
name of amount1, and the others with the names of amount2, amount3, amount4,
and you were to run a macro containing the following code on exit from the
amount1 formfield, it would populate the other formfields with the required
amounts

With ActiveDocument
Select Case .FormFields("amount1").result
Case 60, 75
.FormFields("amount2").result = .FormFields("amount1").result /
3
.FormFields("amount3").result = .FormFields("amount1").result /
3
.FormFields("amount4").result = .FormFields("amount1").result /
3
Case 50
.FormFields("amount2").result = 20
.FormFields("amount3").result = 20
.FormFields("amount4").result = 10
Case 80
.FormFields("amount2").result = 30
.FormFields("amount3").result = 30
.FormFields("amount4").result = 20
Case Else
MsgBox "You must enter 50, 60, 75 or 80."
.FormFields("amount2").result = 0
.FormFields("amount3").result = 0
.FormFields("amount4").result = 0
End Select
End With

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
I would like to automate a letter in Word 2003 so that when a field
value is entered in it, the letter automatically enters three other
vaules elsewhere in the letter?



If then and and

£50 £20 £20 £10

£60 £20 £20 £20

£75 £25 £25 £25

£80 £30 £30 £20



For example if the entered value is £50 then the other three vaulues
will be £20 £20 and £10.

It would also be helpful if you could suggest how to do this with
dates?

I hope you can make a suggestion.

Thanks

John
 
Top