PDA

View Full Version : MenuBar on a form in VBA



Autofreak
02-09-2006, 10:57 AM
Hello Guys,
I am working with VBA and in contrast with VB6 there's no Menu Editor in Tools. How do I put a MenuBar on a form in VBA environment?

Thanks a lot,:hi:
Serge

XLGibbs
02-09-2006, 11:15 AM
HI Serge...

You can add the toolbar control to your toolbox by right clicking and adding controls...that would allow you to drag a toolbar onto a form. You can then add buttons and such...

I think that would work anyway...

Pete

Marcster
02-09-2006, 11:26 AM
Check this out for an impressive way to put a menu on a userform:
http://www.xcelfiles.com/API_Userform_MenuMaker.html
Only works on Excel 2000 and above.

Marcster.

Bob Phillips
02-09-2006, 01:19 PM
Hello Guys,
I am working with VBA and in contrast with VB6 there's no Menu Editor in Tools. How do I put a MenuBar on a form in VBA environment?

Thanks a lot,:hi:
Serge

Difficult!

There are API solutions out there, but I have not found a stable free one yet.

Another solution, and my preferred option, is to to build a VB form, and use this in an Excel solution. However, this is decidedly more complex, and needs a full VB license.

If you are happy with just buttons, XLGibbs toolbar is an option

Autofreak
02-09-2006, 03:22 PM
Check this out for an impressive way to put a menu on a userform:
http://www.xcelfiles.com/API_Userform_MenuMaker.html
Only works on Excel 2000 and above.

Marcster.
Hi Marcster,

Yeah! it is impressive. One problem , it can be modalless...and I can use it only when its ShowModal property is set to False. The author is saying that the right version is coming soon. But it's a great solution anyway. It's cool to be able to work with API's . Where do I start to learn that??

Thanks
Serge

Autofreak
02-09-2006, 03:25 PM
I tried to put a toolbar and a few buttons on it but they slipped thru the toolbar and dropped to the form. How do I make them stay on the toolbar??
Thanks,
serge

XLGibbs
02-09-2006, 04:40 PM
How were you adding the buttons? If you were dragging buttons from the control toolbar to the form, that is why..

I haven't used toolbars on forms except for in VB, so I am just guessing that you have to add them using the commandbar.add(msoControlButton...) type syntax in code...

Similar to make a custom toolbar on the spreadsheet itself...just a guess though..

Marcster
02-10-2006, 07:21 AM
Hi Marcster,

Yeah! it is impressive. One problem , it can be modalless...and I can use it only when its ShowModal property is set to False. The author is saying that the right version is coming soon. But it's a great solution anyway. It's cool to be able to work with API's . Where do I start to learn that??

Thanks
Serge

Here's some info to get you started. It's on MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modcore/html/deovrwhyusevbatocallwindowsapi.asp

HTH,

Marcster.

Norie
02-10-2006, 07:42 AM
Serge

To add buttons to the toolbar got to (Custom) on the properties sheet.

Bob Phillips
02-10-2006, 08:40 AM
Yeah! it is impressive.

It looks good but it ain't exactly stable. I tried it once in a serious app and it hust couldn't be relied on, so I removed it.

Autofreak
02-10-2006, 12:40 PM
Thanks Guys,
those are very helpful tips!! I am gonna go with the toolbar. :thumb do I grade the ansewres on this forum?

Serge