Programmatical Create Custom MENUS

A

Anthony

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"
 
A

Anthony

??

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

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

Tom Wickerath

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
__________________________________________
 
A

Albert D. Kallal

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
 
G

George Nicholson

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,
 

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