Custom Menu Bar in Excel 2007

J

JD McLeod

I am new to Excel 2007 and have two questions. 1. In previous versions, i
was able to create a custom menu bar as a drop down from the top menu and add
macros to it. I could do all of this without having to go in and write code.
Now in 2007, i see how to add a menu bar to the quick access tool bar, but i
can't figure out how to assign macros to that menu bar. Any ideas? 2. How
do you go about creating an add-in that other users could add to their
computer and use? I have never done this before and wanted to know if that
is a good way to share a custom menu bar or tool bar?
Thanks.
 
G

GS

JD McLeod brought next idea :
I am new to Excel 2007 and have two questions. 1. In previous versions, i
was able to create a custom menu bar as a drop down from the top menu and add
macros to it. I could do all of this without having to go in and write code.
Now in 2007, i see how to add a menu bar to the quick access tool bar, but i
can't figure out how to assign macros to that menu bar. Any ideas? 2. How
do you go about creating an add-in that other users could add to their
computer and use? I have never done this before and wanted to know if that
is a good way to share a custom menu bar or tool bar?
Thanks.

Yes, creating an addi is probably the easiest approach because you can
control and maintain the macros in a common toolbar rather than having
to get users to update their custom menus. The menus/toolbar will
appear on the Addins tab of the ribbon.

How To:
Put your code in a workbook saved as an addin (.xla). Include code to
build the toolbar and manage it between sessions so it creates itself
on startup and removes itself on shutdown. Do your programming in the
earliest version of Excel you expect users to have.

Books I recommend:
Excel <version> Power Programming with VBA
by John Walkenbach

Excel <version> VBA Programmer's Reference
by Bovey, Bullen, Green

Additionally, there are many people here in this NG that will help you
along the way!

regards,
Garry
 
D

Dave Peterson

I'm lazy enough to live with the old method -- but I have to look in the Addins
tab on the ribbon to find my customized toolbars.


If you want to learn about modifying the ribbon, you can start at Ron de Bruin's
site:
http://www.rondebruin.nl/ribbon.htm
http://www.rondebruin.nl/qat.htm -- For macros for all workbooks (saved as an
addin)
or
http://www.rondebruin.nl/2007addin.htm

And Bob Phillips shows a way to use a wrapper so that it can work in both xl2003
and xl2007.
http://msmvps.com/blogs/xldynamic/archive/2010/03/27/deploy-me-simple.aspx
 
B

Bob Phillips

Dave Peterson said:
I'm lazy enough to live with the old method -- but I have to look in the
Addins tab on the ribbon to find my customized toolbars.


If you want to learn about modifying the ribbon, you can start at Ron de
Bruin's
site:
http://www.rondebruin.nl/ribbon.htm
http://www.rondebruin.nl/qat.htm -- For macros for all workbooks (saved
as an
addin)
or
http://www.rondebruin.nl/2007addin.htm

And Bob Phillips shows a way to use a wrapper so that it can work in both
xl2003
and xl2007.
http://msmvps.com/blogs/xldynamic/archive/2010/03/27/deploy-me-simple.aspx


Nothing gets by you does it? <bg>
 
D

Dave Peterson

You shared that info to another post. So I figured I'd just add it into one of
my "saved from a previous post" replies.

I figured I'd save you some time! <vbg>
 
G

GS

Hi Bob,

Very nice article! Well done! Props to you...
So nice that I think I might actually try it with my next
workbook-based addin for MSO12+ clients.

I thought about doing similar to this before I decided to make all my
apps COMAddins, but I couldn't resolve the lack of security that tags
along with it. I now do the same thing via code as outlined in Excel
2007 VBA Programmer's Reference. It simply checks version of the host
app to determine what to do. Since my addins are task-specific, I only
use an automated instance where I hide everything except the tab with
my menus. This would be the built-in Addins tab because my menus are
all that's there, AND I still use Rob's table-driven CommandbarBuilder
wrapper for creating custom menus/toolbars as a matter of convenience.
That's about the only code in the xla I open, except for the sub that
passes the entry point parameters to the COMAddin. It's also a single
proc used by all menus, which passes their OnAction via the Tag prop
and any parameters as a delimited string via the Parameter prop.

Lots of similarities but not as easy as the old days, huh!

Regards,
Garry
 
B

Bob Phillips

You shared that info to another post. So I figured I'd just add it into
one of my "saved from a previous post" replies.


That is what I mean, you see everything. I think there are lots of you in
reality, Dave Peterson is really a franchise <ebg>
 
D

Dave Peterson

Or just retired with nothing better to do!



Bob said:
That is what I mean, you see everything. I think there are lots of you in
reality, Dave Peterson is really a franchise <ebg>
 
D

Dave Peterson

Hmmm.

The headers must have gotten confused in my newsreader. Now my response to Bob
shows up as a response to Bob. But my response to my response is under GS's
message.

Hmmm.
 
D

Dave Peterson

They showed up in the correct location after I changed newsgroups and came back
to this -- and also when I close the reader and reopened it.

And when I connected to a different news server, they looked right there, too.

I don't know why it happened (over and over and over).
 
G

GS

Dave Peterson expressed precisely :
They showed up in the correct location after I changed newsgroups and came
back to this -- and also when I close the reader and reopened it.

And when I connected to a different news server, they looked right there,
too.

I don't know why it happened (over and over and over).

I noticed the same behavior when I was testing Tbird, and is why I
didn't choose it. <FWIW>I tested the latest version.
 
B

Bob Phillips

You mean you don't run that help service any more? I didn't know that.

So you must have time to attend the summit now?

Bob
 
D

Dave Peterson

I tried TB (Portable) and I was having trouble, too. I would still be using
Netscape4.79, but it has trouble accessing the new MS NNTPBridge.

So I'm trying NS7.2 (2004).

The thread was screwed up (again), so I closed and reopened and it looked fine.
 
D

Dave Peterson

Help service????

And who knows about the summit (or MVP-hood) nowadays???

Bob said:
You mean you don't run that help service any more? I didn't know that.

So you must have time to attend the summit now?

Bob
 
J

JD McLeod

Thanks GS. Not that it matters, but why the change in Excel 2007? It seemed
so easy for us "novice" users to create custom menus in the earlier version.
It seems very much more complicated now. Anyway, I read where i will need to
download RibbonX in order to create the add-in menus i need. Will other
users of the add-in have to also download RibbonX or is that just for
developing the add-ins? Thanks.
 
G

GS

JD McLeod used his keyboard to write :
Thanks GS. Not that it matters, but why the change in Excel 2007? It seemed
so easy for us "novice" users to create custom menus in the earlier version.
It seems very much more complicated now. Anyway, I read where i will need to
download RibbonX in order to create the add-in menus i need. Will other
users of the add-in have to also download RibbonX or is that just for
developing the add-ins? Thanks.

RibbonX is part of Excel. You just need to download the viewer (Custom
UI Editor for MS Office) to allow you to edit the XML that is used to
modify the ribbon. I recommend you follow Dave's links. Bob Phillip's
article is one of the best I've seen on the web so far. Ron de Brun has
some good xlsm samples on his site as well. I don't use workbook-based
addins much anymore but yes, your addin will set up the ribbon for
anyone who uses it.

As for why M$ changed things goes, the answer is in their second
initial! It definitely complicates programming more than it needs to
be, though. That's partly why I stopped using workbook addins. Problem
I see here is that the next workbook opened that changes the ribbon
puts your addin in the back seat until it closes. I suspect Excel
toggles settings according to which workbook is active but that
scenario doesn't appeal to me at all. Most all my addins are
task-specific apps that I prefer to run as dictator apps in their own
instance of Excel. That way I can hide the default ribbon tabs and use
my own menus/toolbars by ensuring the Addins tab is the only one
available. This can be done with workbook addins too but many of my
clients are overly security cautious and so I use VB6 COMAddins.
Fortunately, this is the only case where the XML can be passed via
code. Otherwise, I'd need to use a dummy xlsm to set up my UI. Way too
much hooplah for me! Besides, the Addins tab supports using our earlier
version menus and toolbars so why try to fix what ain't broke? Most my
addins use a table-driven system for creating menus/toolbars and so I
use the same xla to do that and have all menus use a common procedure
(as in the sample in Bob's article) to pass the OnAction (in the Tag
prop) and any parameters (in the Parameter prop) to the COMAddin. Bob's
example uses the 'Run' method to execute his procs in the xla. My
COMAddin uses the 'CallByName' function to do the same thing,
respectively.

Yep, the ribbon sure has brought a lot of hassles into the picture.
Nice thing about my approach is 'no ribbon, no hassles'! I totally lock
down Excel so the user only has access to features and functionality
required to use my app. That completely removes any distractions caused
by the Excel UI that isn't being used. It also allows me to prevent
opening workbooks that don't belong to my app. Fact is, some of my
clients don't even realize they're using Excel!

Anyway, follow those links and you'll have results you can smile about.

regards,
Garry
 
J

JD McLeod

One last question on this topic before I begin. I am able to add commands to
the "quick acces toolbar" such as Menu Commands and Toolbar Commands. When i
click on them, they drop down as if they should have more choices on them to
select from. This resembles the old style of custom menus. How do you or
can you add additional items to these menus. I found them by selecting "More
Commands" from the quick access tool bar and they were under the Add-ins
section. Thanks.
 
G

GS

JD McLeod presented the following explanation :
One last question on this topic before I begin. I am able to add commands to
the "quick acces toolbar" such as Menu Commands and Toolbar Commands. When i
click on them, they drop down as if they should have more choices on them to
select from. This resembles the old style of custom menus. How do you or
can you add additional items to these menus. I found them by selecting "More
Commands" from the quick access tool bar and they were under the Add-ins
section. Thanks.

I'm sorry but I've never had reason to use that feature and so I can't
help you with it. Hopefully someone else will pick it up and run with
it. I'm sure I could look it up somewhere, but there's probably lots
more folks here better able to address this than I would be able to in
the short term.

Since this can also be done via the UI, try recording a macro and going
through the steps to see if it generates any code.

Garry
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top