Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Programmatical Create Custom MENUS

0 views
Skip to first unread message

Anthony

unread,
Jan 25, 2007, 4:26:29 PM1/25/07
to
How do I programatically create customer Menus, programmatically
disable/enable specific menu items, etc., add/remove menu items, etc.

I tried this stuff, but I cant get it to work the way I want:

For Each cmb In CommandBars
If cmb.Name = "myCommandBar" Then
cmb.Delete
End If
Next cmb
Set cmb = Application.CommandBars.Add("myCommandBar")
cmb.Visible = True
cmb.Position = msoBarTop
Dim cbp As CommandBarPopup

Set cbp = cmb.Controls.Add(msoControlPopup)

cbp.Caption = "CST &Main Menu"


Alex Dybenko

unread,
Jan 25, 2007, 4:53:14 PM1/25/07
to
Hi,
have a look at this sample:
http://www.pointltd.com/Downloads/Details.asp?dlID=19

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

"Anthony" <no_...@please.com> wrote in message
news:%23hlN7dM...@TK2MSFTNGP04.phx.gbl...

Anthony

unread,
Jan 25, 2007, 5:30:10 PM1/25/07
to
??

Sorry, I didn't understand what you are intending to convey...

What does "Messaging Example" have to do with custom menus?


"Alex Dybenko" <ale...@PLEASE.cemi.NO.rssi.SPAM.ru> wrote in message
news:OaxF3sMQ...@TK2MSFTNGP05.phx.gbl...

Tom Wickerath

unread,
Jan 25, 2007, 5:50:01 PM1/25/07
to
Hi Anthony,


> What does "Messaging Example" have to do with custom menus?

I don't think you read carefully enough. I've copied the text from Alex's
web page, and added a little emphasis below:


Messaging Example

MS Access97 and MS Access 2000 MDB file with examples how to send messages
via MAPI using OLE Messaging or Active Messaging, how to build text editor in
MS Access using MS RFT ActiveX Control,

******how to create and customize Office toolbars ******

and use Common Dialog API functions.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

Albert D. Kallal

unread,
Jan 25, 2007, 6:00:18 PM1/25/07
to
"Anthony" <no_...@please.com> wrote in message
news:%23hlN7dM...@TK2MSFTNGP04.phx.gbl...

> How do I programatically create customer Menus, programmatically

> disable/enable specific menu items, etc., add/remove menu items, etc.

You don't have to use code to create menus. You can use code to build a
report, or code to build a form, but for the most part, it is FAR FAR easier
to simply use the graphical interface to build a form, or report.

The same applies to building custom menus. For the most part, you don't want
to use code to create the menus, but simply right click on the menu bar..and
can then select customize.

Take a look at the following screen shots of ms-access, and of the menus
were built simply using the mouse..and drag and drop:

http://www.members.shaw.ca/AlbertKallal/Articles/UseAbility/UserFriendly.htm

> programmatically disable/enable specific menu items, etc., add/remove menu
> items, etc.


you can use:

if IsInGroup(CurrentUser,"SuperUser" then

CommandBars("menu bar").
Controls("records").
Controls("refresh").Visible = True

end if

if IsInGroup(CurrentUser(),"InvoideDeleteGroup") = true then

CommandBars("myCustomBar").
Controls("AdminOptions").
Controls("DleeteInvoice").Visible = True

end if

I wrapped the one above line into 3 for easy reading..but, it should be on
one line. In the above, we are "walking" the menu structure I have, and the
first menu is the main..and then adminOptions would have been a cascade
menu..and inside..we finally reach the DleeteInvoice option which we ONLY
make visible if the user is a member of the InvoiceDeleteGroup.

You also use "enabled" in place of visible to grey out (disable) menu
items....

You most certainly can, and should hide all of the ms-access interface. The
options to complete hide and keep people out of the ms-access interface can
easily be done using the tools->start-up options. Using those options allows
you to complete hide the ms-access interface (tool bars, database window
etc). Also, using these options means you
do not have to bother setting up security.

Try downloading and running the 3rd example at my following web site that
shows a hidden ms-access interface, and NO CODE is required to do
this....but just some settings in the start-up. Also note THAT THE menu
bar CHANGES for the different forms....

Check out:

http://www.members.shaw.ca/AlbertKallal/msaccess/DownLoad.htm

After you try the application, you can exit, and then re-load the
application, but hold down the shift key to by-pass the start-up options. If
want, you can even disable the shift key by pass. I have a sample mdb file
that will let you "set" the shift key bypass on any application you want.
You can get this at:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOO...@msn.com


George Nicholson

unread,
Jan 25, 2007, 6:29:36 PM1/25/07
to
http://support.microsoft.com/kb/830502/en-us
"How to Customize Menus and Menu Bars in Excel"
Is applicable to any Office app, once you make the obvious translations
(like actual toolbar names). It may be way more information than you want,
but odds are the information is there. (I love this article...)

If that doesn't help, you might be a tad more specific than
" I cant get it to work the way I want..."


HTH,


"Anthony" <no_...@please.com> wrote in message
news:%23hlN7dM...@TK2MSFTNGP04.phx.gbl...

Alex Dybenko

unread,
Jan 26, 2007, 5:57:51 AM1/26/07
to
there is a code also to build custom menu, as you see on a picture

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


"Anthony" <no_...@please.com> wrote in message

news:eNQIhBN...@TK2MSFTNGP02.phx.gbl...

0 new messages