Solved

Visual Basic for Applications (Office 97) adding Buttons to a toolbar

Posted on 1997-06-18
2
527 Views
Last Modified: 2013-11-25
I'm trying to add a button to a toolbar in Word '97.  But wait!  It's not as simple as it sounds.  The specific button type is actually msoControlButtonDropdown.  I can add msoControlButton and msoControlComboBox to a toolbar, but thats it.  Anything else gives me some sort of error, whether it be a compiler error, or whether it be another generic error of somesort.  Below is a piece of example code.

Sub CreateToolbar()
    Dim cbarNewBar As CommandBar
       
    Set cbarNewBar = Application.CommandBars.Add("Custom")
    Set cbutton = CommandBars("Controls").Controls.Add(Type:=msoControlButtonDropdown)
    barNewBar.Visible = True
       
End Sub
0
Comment
Question by:edc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
ChrisLewis earned 200 total points
ID: 1427425
The add method of CommandBars only supports the following types:
msoControlButton
msoControlEdit
msoControlDropdown
msoControlComboBox
msoControlPopup

I don't believe that it is possible at this time to add a button drop down in VBA to Word97.

Sorry

Chris


0
 
LVL 1

Author Comment

by:edc
ID: 1427426
Microsoft gave me a bit of a work around on this one, but not with all the functionality that I was hopeing for.  It's not possible in the conventional sense of adding a button, but it can be done to a limited degree.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question