Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Word - VBA script to display text on form


Word - VBA script to display text on form

Author
Message
Barry
Barry
Forum God
Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)

Group: Forum Members
Posts: 7, Visits: 27

I need to create a Word macro/vba script to display text to the right of a form field if a particular field value is select from the list of values. I currently have a script (Dropdown8 is a combo box, Text22 is a text box) that works (below), but only changes the text if, after changing the value in Dropdown8, you tab to another field and then reselect it a second time. Can someone help me to figure out what to do so that it(Text22) is updated each time the value in Dropdown8 is changed?

Code:
Sub Dropdown8_Click()
If ActiveDocument.FormFields("Dropdown8").Result = "Ogallala" Then
ActiveDocument.FormFields("Text22").Result = "SAR Model Needed"
Else
ActiveDocument.FormFields("Text22").Result = " "
End If


Barry

B&W Pantex
Edited
6/29/2009 by Barry
Barry
Barry
Forum God
Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)

Group: Forum Members
Posts: 7, Visits: 27

I added

Application.ScreenUpdating = False
to the beginning of script event, and

Application.ScreenUpdating = True
to the end of the script event, which works as long as tab out before selecting another value.  But, if try to change value (of Dropdown8), without tabbing out, (Text22) does not update.

Barry

B&W Pantex
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search