Manually create Command Bar in 2007

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Manually create Command Bar in 2007

Post by Don Wells »

Code: Select all

Set cbr = Application.CommandBars.Add(BarName, msoBarTop, False, True)
The preceding line of code is working on some machines, but fails on at least one. In my troubleshooting endeavour, I want to determine if I can create the command bar manually. In 2003 I would pull down Tools > Customize, then under the Toolbars tab click New. I am unable to find the appropriate keystrokes to manually create a new toolbar in the Custom Toolbars area of the Add-Ins ribbon of Word 2007.

Any guidance will be greatly appreciated.
Regards
Don

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Manually create Command Bar in 2007

Post by HansV »

You can't create a custom toolbar in the interface of Word 2007 (nor in Access 2007, Excel 2007 or PowerPoint 2007; you can in Outlook 2007 since it still uses the old menu/toolbar interface). :sad:
Best wishes,
Hans

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Manually create Command Bar in 2007

Post by Don Wells »

HansV wrote:You can't create a custom toolbar in the interface of Word 2007 (nor in Access 2007, Excel 2007 or PowerPoint 2007; you can in Outlook 2007 since it still uses the old menu/toolbar interface). :sad:
Thank you Hans
:bwaah:
Regards
Don

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Manually create Command Bar in 2007

Post by Wendell »

One thing that may alleivate the pain a bit is the ability to customize the Quick Access Toolbar - that can be helpful in some cases. In at least one application (Access) you can use custom toolbars created in earlier versions, but I don't think that applies to Word.
Wendell
You can't see the view if you don't climb the mountain!

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Manually create Command Bar in 2007

Post by HansV »

Custom toolbars work in Excel, PowerPoint and Word too; they are displayed in the Add-ins tab of the ribbon.
They can be created and edited using VBA, but not interactively, in the interface.
Best wishes,
Hans

JudyL
NewLounger
Posts: 20
Joined: 10 Apr 2010, 05:23
Location: Seattle, Washington, USA

Re: Manually create Command Bar in 2007

Post by JudyL »

I tried running my old 2003 normal.dot as a global template in 2007,* just to see what would happen. The first thing I noticed was that my Autotext entries appeared in Building Blocks, and that is kind of neat.

Also, buttons from my old normal custom toolbars appeared in the Add-Ins tab, but better yet (for my purposes) I found a command that can be added to the QAT, called "Custom Toolbars", and now the commands and macros for which I had buttons in custom toolbars in 2003 (in normal.dot) are available in the Custom Toolbars button on my QAT, with their old button icons. The beauty of this, for me, is that the QAT doesn't disappear, like the ribbont tabs do...

By fiddling around with the old 2003 normal.dot toolbars a little (thank goodness we kept one machine with Word 2003 on it), I achieved some control over the appearance of the contents of this QAT button's display. I also put some of the old Menus into a toolbar, so now I have access to the old menus (not every command in them works, of course, esp. in Tools). It looks like this:

[aack, couldn't figure out how to get jpg in here, sorry]

I'm trying not to depend on my old 2003 buttons too much, as I need to be familiar enuf with Word 2007 to be able to help other users at work. And I imagine that there are downsides to running the 2003 normal.dot as a global template,* but I'm currently getting a big kick out of it!

Judy

*which happens automatically if you put the normal.dot in the 2007 Word startup area -- for me that's C:\Documents and Settings\JudyL\Application Data\Microsoft\Word\STARTUP

p.s. I edited this quite a bit when I got home from work -- just didn't have time to work with it earlier -- so it may read a little differently now, if you've read it once already [1:50 a.m., 4-10-10, Seattle WA USA]

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Manually create Command Bar in 2007

Post by HansV »

Welcome to Eileen's Lounge!

Thanks for the tips, especially that of adding the "Custom Toolbars" button to the QAT!

A picture is just an attachment. See Tip: adding an attachment using the prosilver skin (or the one below it if you use another skin).
Best wishes,
Hans

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Manually create Command Bar in 2007

Post by Wendell »

Hi JudyL - welcome to Eileen's Lounge, and thanks for sharing something that will no doubt be useful to others who are transitioning to Office 2007 from older versions.
Wendell
You can't see the view if you don't climb the mountain!

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Manually create Command Bar in 2007

Post by Don Wells »

Don Wells wrote:

Code: Select all

Set cbr = Application.CommandBars.Add(BarName, msoBarTop, False, True)
The culprit in this case was a corrupted Normal.dotm
Regards
Don

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Manually create Command Bar in 2007

Post by HansV »

Thanks for letting us know what caused the problem!
Best wishes,
Hans

JudyL
NewLounger
Posts: 20
Joined: 10 Apr 2010, 05:23
Location: Seattle, Washington, USA

Re: Manually create Command Bar in 2007

Post by JudyL »

"The preceding line of code is working on some machines"

So, Don, you mean that this code creates a customizable toolbar in 2007? (I'm code-ignorant.)

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Manually create Command Bar in 2007

Post by HansV »

Don will have to provide the definitive answer, but I think the code creates a pre-Office 2007 style toolbar that will be displayed in the Add-Ins tab of the ribbon, or from the Custom Toolbars button on the QAT that you taught me about. The toolbar will not be customizable in the interface of Word 2007 but it can be modified using VBA code.
Best wishes,
Hans

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Re: Manually create Command Bar in 2007

Post by Don Wells »

JudyL wrote:"The preceding line of code is working on some machines"

So, Don, you mean that this code creates a customizable toolbar in 2007? (I'm code-ignorant.)
    As Hans has implied, this is code that was developed in Office 2000 and 2003; then with the implementation of 2007, carried across without change. My customization by code consists of deleting and rebuilding.
Regards
Don

JudyL
NewLounger
Posts: 20
Joined: 10 Apr 2010, 05:23
Location: Seattle, Washington, USA

Re: Manually create Command Bar in 2007

Post by JudyL »

Aha -- thanks, Hans and Don.

Two little advantages I've found to exploiting the QAT Custom Toolbars button rather than the Add-ins tab:

1) pressing a button on the QAT doesn't change the tab and ribbon that you are currently viewing and perhaps working with, and
2) the document itself is closer to the QAT than to the Tabs, as the cursor flies (if the QAT resides below the ribbon rather than next-door to the MOB).