Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo in toolbar (2000/2003)

    Hi all,

    I am trying to add a combo box to the toolbar in word, I want to specify the values and then be able to access the selected value from a macro. I also want a text box unbound the idea been that the user can select their department from the combo and type a six digit filename into the text box then I was going to use an onupdate or onkeypress event to run the macro.

    I already have the macro code done and working but at the moment it uses input boxes for the combo and filename, this is causing some user error when they type their department name differently to what is in the directory structure

    Many thanks

    Kevin
    Regards
    Gerbil (AKA Kevin)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo in toolbar (2000/2003)

    If you want the user to be able to select items from the list only, create a control of type msoControlDropdown instead of msoControlComboBox.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo in toolbar (2000/2003)

    Sorry Hans, you lost me. I don't understand. Can you please give a little more information.

    Many thanks

    Kevin
    Regards
    Gerbil (AKA Kevin)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo in toolbar (2000/2003)

    What code are you using to create/populate the combos?

  5. #5
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo in toolbar (2000/2003)

    None, I don't know how to get the combos.

    I am trying to put a combo in the toolbar i.e next to the font size dropdown.

    Beacuse I don't know how to creat a combo in the toolbar or how to call its value from within a macro I am currently using inputboxes, which is causing errors (typos)

    Thanks

    Kevin
    Regards
    Gerbil (AKA Kevin)

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo in toolbar (2000/2003)

    See for example the thread starting at <post:=637,742>post 637,742</post:>.

  7. #7
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo in toolbar (2000/2003)

    Thanks Hans I've got to combo box

    Whats the line for a text box. msoControl???????

    Just trying to figure out how to call the slection from another macro now.

    Thanks

    Got it know the combo works fine and the script is looking for the selected value. Just the text box!

    Thanks
    Regards
    Gerbil (AKA Kevin)

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo in toolbar (2000/2003)

    To create a text box, use msoControlEdit as type in ...Controls.Add.

  9. #9
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo in toolbar (2000/2003)

    Thanks Hans
    Regards
    Gerbil (AKA Kevin)

  10. #10
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo in toolbar (2000/2003)

    Thanks again

    I am using the below code;

    Sub AddLetterSearchFeature()
    Dim barText
    Dim barSpec

    Set barSpec = CommandBars _
    .Add(Name:="Specialty and CRN", Position:=msoBarTop, _
    Temporary:=False)
    barSpec.Visible = True

    Set ctrlSpec = barSpec.Controls _
    .Add(Type:=msoControlDropdown)

    With ctrlSpec
    .AddItem "DEPT1"
    .AddItem "DEPT2"

    End With

    Set ctrlText = barSpec.Controls _
    .Add(Type:=msoControlEdit)

    With ctrlText
    .OnAction = "LetterFinder"
    End With
    End Sub

    And then using

    strSpec = CommandBars("Specialty & CRN").Controls(1).Text
    strCRN = CommandBars("Specialty & CRN").Controls(2).Text

    To use the users selection to open a letter. How do I get the strSpec and strCRN to use the selections from the right combo or text box.

    I.e strSpec = data from the combo
    strCRN = data from the text box

    Many thanks

    Kevin
    Regards
    Gerbil (AKA Kevin)

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo in toolbar (2000/2003)

    Don't the two lines that you posted

    strSpec = CommandBars("Specialty & CRN").Controls(1).Text
    strCRN = CommandBars("Specialty & CRN").Controls(2).Text

    do just that?

  12. #12
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo in toolbar (2000/2003)

    Yes they do sorry Hans the reason they did not work was a typo

    "Specialty & CRN" should be "Specialty and CRN"

    Thanks for your reply

    Kevin
    Regards
    Gerbil (AKA Kevin)

  13. #13
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo in toolbar (2000/2003)

    Hi all,

    Is it possible to increase the width of the combo box, some of the titles are very long and its hard to read. Is it also possible to change the background colour of the tool bar itself

    Many thanks

    Kevin
    Regards
    Gerbil (AKA Kevin)

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo in toolbar (2000/2003)

    The Width property of a command bar control specifies the width of the control itself
    The DropDownWidth property of a command bar combo box specifies the width of the dropdown list; if you set this to -1 it will be adjusted to fit the longest item.
    Both are measured in points, where 1 inch = 72 points.

    The background color of toolbars is a Windows setting, in the Appearance tab of the Display Properties control panel.

  15. #15
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo in toolbar (2000/2003)

    Thanks Hans, thats great

    I was hoping there would be a way to change the colour of my specific toolbar.

    Thank you
    Regards
    Gerbil (AKA Kevin)

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •