Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Linking dropdown boxes (box 2 list dependent on box 1 choice)
I found two similar questions, but I still can't figure out the first
step...How to get the dropdown box1 to know to run the VBA code. I add the ddb form field via the toolbar button, then click on the VB Editor toolbar button...but that doesn't link anything. I'm sure I'm missing something simple, but any help would be much appreciated. Jeff |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Linking dropdown boxes (box 2 list dependent on box 1 choice)
First write the macro that populates the second box based on the value
selected in the first box. Then open the Properties dialog of the first box (most easily by double-clicking the box), look in the "Exit" dropdown, and select the name of the macro you wrote. When the user tabs or mouse-clicks out of the first box, the macro will run before the next form field gets the focus. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Jeff Kunberger wrote: I found two similar questions, but I still can't figure out the first step...How to get the dropdown box1 to know to run the VBA code. I add the ddb form field via the toolbar button, then click on the VB Editor toolbar button...but that doesn't link anything. I'm sure I'm missing something simple, but any help would be much appreciated. Jeff |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Linking dropdown boxes (box 2 list dependent on box 1 choice)
Okay,
So I add two drop down boxes to my document. Then go to the first drop down box and input all the items to appear in that list. Then I write the macro to look at the choice in ddb 1 and populate ddb 2 based on the choice? The only vba code I found to do a cascading list box uses a table in a different file. I dont' want to reference another document. I want just input the data in the code, (ie. If Alpha, then display Apple, Alligator, Audi; If Beta, then display Baseball, Book, Bumper..etc). Any suggestions? "Jay Freedman" wrote: First write the macro that populates the second box based on the value selected in the first box. Then open the Properties dialog of the first box (most easily by double-clicking the box), look in the "Exit" dropdown, and select the name of the macro you wrote. When the user tabs or mouse-clicks out of the first box, the macro will run before the next form field gets the focus. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Jeff Kunberger wrote: I found two similar questions, but I still can't figure out the first step...How to get the dropdown box1 to know to run the VBA code. I add the ddb form field via the toolbar button, then click on the VB Editor toolbar button...but that doesn't link anything. I'm sure I'm missing something simple, but any help would be much appreciated. Jeff |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Linking dropdown boxes (box 2 list dependent on box 1 choice)
Something like this:
Sub OnExitDD() Dim oFF As FormFields Set oFF = ActiveDocument.FormFields oFF("Dropdown2").DropDown.ListEntries.Clear Select Case oFF("Dropdown1").Result Case "A" With oFF("Dropdown2").DropDown.ListEntries .Add "Apples" .Add "Apricots" .Add "Angel food cake" End With Case "B" ' Case "C" ' End Select End Sub On Mar 23, 11:36 am, Jeff Kunberger wrote: Okay, So I add two drop down boxes to my document. Then go to the first drop down box and input all the items to appear in that list. Then I write the macro to look at the choice in ddb 1 and populate ddb 2 based on the choice? The only vba code I found to do a cascading list box uses a table in a different file. I dont' want to reference another document. I want just input the data in the code, (ie. If Alpha, then display Apple, Alligator, Audi; If Beta, then display Baseball, Book, Bumper..etc). Any suggestions? "Jay Freedman" wrote: First write the macro that populates the second box based on the value selected in the first box. Then open the Properties dialog of the first box (most easily by double-clicking the box), look in the "Exit" dropdown, and select the name of the macro you wrote. When the user tabs or mouse-clicks out of the first box, the macro will run before the next form field gets the focus. -- Regards, Jay Freedman Microsoft Word MVP FAQ:http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Jeff Kunberger wrote: I found two similar questions, but I still can't figure out the first step...How to get the dropdown box1 to know to run the VBA code. I add the ddb form field via the toolbar button, then click on the VB Editor toolbar button...but that doesn't link anything. I'm sure I'm missing something simple, but any help would be much appreciated. Jeff- Hide quoted text - - Show quoted text - |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Linking dropdown boxes (box 2 list dependent on box 1 choice)
Thanks to Greg and Jay for all their help. I was able to get it working like
I wanted. "Greg Maxey" wrote: Something like this: Sub OnExitDD() Dim oFF As FormFields Set oFF = ActiveDocument.FormFields oFF("Dropdown2").DropDown.ListEntries.Clear Select Case oFF("Dropdown1").Result Case "A" With oFF("Dropdown2").DropDown.ListEntries .Add "Apples" .Add "Apricots" .Add "Angel food cake" End With Case "B" ' Case "C" ' End Select End Sub On Mar 23, 11:36 am, Jeff Kunberger wrote: Okay, So I add two drop down boxes to my document. Then go to the first drop down box and input all the items to appear in that list. Then I write the macro to look at the choice in ddb 1 and populate ddb 2 based on the choice? The only vba code I found to do a cascading list box uses a table in a different file. I dont' want to reference another document. I want just input the data in the code, (ie. If Alpha, then display Apple, Alligator, Audi; If Beta, then display Baseball, Book, Bumper..etc). Any suggestions? "Jay Freedman" wrote: First write the macro that populates the second box based on the value selected in the first box. Then open the Properties dialog of the first box (most easily by double-clicking the box), look in the "Exit" dropdown, and select the name of the macro you wrote. When the user tabs or mouse-clicks out of the first box, the macro will run before the next form field gets the focus. -- Regards, Jay Freedman Microsoft Word MVP FAQ:http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Jeff Kunberger wrote: I found two similar questions, but I still can't figure out the first step...How to get the dropdown box1 to know to run the VBA code. I add the ddb form field via the toolbar button, then click on the VB Editor toolbar button...but that doesn't link anything. I'm sure I'm missing something simple, but any help would be much appreciated. Jeff- Hide quoted text - - Show quoted text - |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Linking dropdown boxes (box 2 list dependent on box 1 choice)
Good morning Mr. Freedman,
I am trying to link drop down boxes in my Word 2003 document and would greatly appreciate any help that you can provide. I am an experienced user, but not a technical writer. What I want to do is as follows: ddb1 ddb3 ddb2 If x users (ddb1) is selected, than y $value (ddb3) is selected and z training sessions (ddb2) is selected. Can you please tell me how to do this? "Jay Freedman" wrote: First write the macro that populates the second box based on the value selected in the first box. Then open the Properties dialog of the first box (most easily by double-clicking the box), look in the "Exit" dropdown, and select the name of the macro you wrote. When the user tabs or mouse-clicks out of the first box, the macro will run before the next form field gets the focus. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Jeff Kunberger wrote: I found two similar questions, but I still can't figure out the first step...How to get the dropdown box1 to know to run the VBA code. I add the ddb form field via the toolbar button, then click on the VB Editor toolbar button...but that doesn't link anything. I'm sure I'm missing something simple, but any help would be much appreciated. Jeff |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I create dependent drop down boxes in Word 2003? | Microsoft Word Help | |||
Tutorial for Dropdown boxes in a Word table on the Web? | New Users | |||
Hyperlinks in Word Dropdown Boxes | Microsoft Word Help | |||
Expanding dropdown boxes - office. | Microsoft Word Help | |||
Linking dropdown form fields | Microsoft Word Help |