Results 1 to 5 of 5

Thread: MS Word 2010 Execute Macros from Dropdown Menu

  1. #1
    Join Date
    Jun 2011
    Posts
    3

    MS Word 2010 Execute Macros from Dropdown Menu

    I have created a form in word, there is a dropdown menu with three choices. Selecting either of the first two choices needs to run two other macros I created, or selecting the third option needs to run two separate macros. I am new to doing this stuff in word.

    From what I can tell there are three types of drop-down controsl in word, a combo box content control (which is what I currently have on the form), and two legacy options, a drop-down form field, or an activex combo box.

    Is there a way to execute these macros based on the selection in the combo box content control, or should I be using a different type of field?

    I put in an activex combo box, and was able to see the "onchange" event, but I have no experience with activex controls, and am unsure how you would set it's values. I am assuming through vba, but am still looking into that.

    Any assistance is appreciated.

    Thanks!

  2. #2
    Join Date
    Dec 2007
    Posts
    2,291

    Re: MS Word 2010 Execute Macros from Dropdown Menu

    You can try to use the Change Event of the ComboBox from the Control Toolbox. For example;

    Code:
    Private Sub ComboBox1_Change()
    If ComboBox1.ListIndex > -1 Then Run ComboBox1
    End Sub

  3. #3
    Join Date
    Jun 2011
    Posts
    3

    Re: MS Word 2010 Execute Macros from Dropdown Menu

    Are you referring to using the "Legacy Drop-Down Menu", the "Activex combo box", or the "Content Control Combo Box"?

  4. #4
    Join Date
    Nov 2009
    Posts
    612

    Re: MS Word 2010 Execute Macros from Dropdown Menu

    Try the below simplest way to solve this problem. Place this code in the worksheet module, right click on the sheet tab and select view codes, copy and paste this code there.

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$F$1" Then
    If Target = "A" Then
    macro1
    ElseIf Target = "B" Then
    macro2
    ElseIf Target = "C" Then
    macro3
    End If
    End Sub
    F1 assumes to be the drop down menu

  5. #5
    Join Date
    Jun 2011
    Posts
    3

    Re: MS Word 2010 Execute Macros from Dropdown Menu

    It appears to me your solution would apply to an excel spreadsheet, not a word document?

    Something curious, in my testing yesterday, when I insert a "Legacy Drop-Down Menu" I can go in and add the three options I want in the menu, but the control never functions as a drop-down menu, even once the sheet is protected. I don't want to have to protect the sheet, since this disables the use of spell checker, so it appears that using the "Content Control Combo Box" or the "activex combo box" will be my only options. I will continue researching to see if I can figure out the activex control, other wise I have to use xml with the content control, and I have no experience with xml.

    Thanks!

Similar Threads

  1. Themes and Macros on MS word 2010 with Mac OS X Lion
    By DeepakTij in forum Windows Software
    Replies: 4
    Last Post: 04-01-2012, 08:26 PM
  2. Macros disappear while closing MS word 2010
    By Ouka in forum Windows Software
    Replies: 7
    Last Post: 01-09-2011, 09:33 AM
  3. OS 10.4 Safari Where's the dropdown URL menu
    By Elizabeth Allen in forum Technology & Internet
    Replies: 7
    Last Post: 30-07-2010, 06:07 AM
  4. Replies: 6
    Last Post: 27-07-2010, 06:09 PM
  5. Dropdown menu problem
    By Heather5 in forum Software Development
    Replies: 3
    Last Post: 21-11-2009, 09:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,582,406.98073 seconds with 17 queries