Automatically fillin fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have designed a template and would now like to automate part of it. I want
to have it so that if I select a name from dropdown5 (say Bill Bloggs) then
text field 10 is automatically filled in with that persons phone ext number
(i.e. 54516). If I select John Smith from Dropdown5 then a different ext
number is automatically filled in. Can this be done from word?

Any assistance would be appreciated

Paul
 
Yes it is possible.

An adaptation of this should work:
Sub OnExitDDList()
Dim oFFs As FormFields
Set oFFs = ActiveDocument.FormFields
Select Case ActiveDocument.FormFields("DropDown1").Result
Case "A"
oFFs("Text1").Result = "123"
Case "B"
oFFs("Text1").Result = "567"
Case "C"
oFFs("Text1").Result = "89"
End Select
End Sub
 
Thanks for your prompt reply. I am relatively new to this sort of thing so
am unsure on how to make it all work. I have adapted as follows

Sub OnExitDDList()
Dim oFFs As FormFields
Set oFFs = ActiveDocument.FormFields
Select Case ActiveDocument.FormFields("DropDown1").Result
Case "A"
oFFs("Text10").Result = "54516"
Case "B"
oFFs("Text10").Result = "56997"
Case "C"
oFFs("Text10").Result = "56889"
End Select
End Sub

I am assuming I have to save this as a macro (name?) and attache it to this
template. Does it automatically determine what case A, B etc is or do I have
to change this to reflect names etc.

Sorry to be a pain but as I said I am relatively new to this sort of thing

Paul
 
You will need to put the macro in the template project for the document.
Leave it named as is or name it whatevery you want. Set the macro to run on
exit from the dropdown field containing the names. Yes, you will need to
change A, B, C, etc, to the names of the individuals you select.
 
Back
Top