Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: How To Create MenuCommand Bar by VBA

Geek News

How To Create MenuCommand Bar by VBA
"kapusta117" <u47866[ at ]uwe> 11/30/2008 4:36:20 PM
Hello

I m working in ACCESS 2000 ...i m trying for the first time creating
Commanbar Menu..
WHEN i'm executing tHE vba code below (from a Macro) :

Public Function CreerMenu()
'
======================================================================================
' Auteur : Starec - Philippe JOCHMANS -
http://starec.developpez.com
' Description : Création d'une barre de menu

'=======================================================================================

' ==== déclaration =====
'Dim cmb As Office.CommandBars


' ===== affectation =====
' Set cmb = Application.CommandBars.Add("MaBarre", msoBarTop, True, True)

' ===== rendre la barre visible =====
'cmb.Application.Visible = True


' MsgBox "test"

End Function




I HAVE A MESSAGE ERROR Telling me that the expression has undefined function;
Although this function exist ( i tested

Public Function CreerMenu()
msgbox "TEST"
end function


launch this code by MACRO worked properly.


I HAVE TO MENTION that i 'm using Microsoft office 9.0 OBJECT that normaly
suit with ACCESS 2000

Thank you for you help

--
Message posted via http://www.accessmonster.com

Re: How To Create MenuCommand Bar by VBA
"kapusta117" <u47866[ at ]uwe> 11/30/2008 4:41:41 PM
Hello

I have resolved ..this probleme It was a probleme linked with micrsoft object
librairies...

I have succeed creating my MenuBarr BUT i dont know How to put mu MenuBarr
Inside MY FORM and not showing it inside STANDAR ACCESS Menus

Could you help me?

Thank you
Re: How To Create MenuCommand Bar by VBA
Rick Brandt <rickbrandt2[ at ]hotmail.com> 11/30/2008 5:32:29 PM
On Sun, 30 Nov 2008 16:41:41 +0000, kapusta117 wrote:

[Quoted Text]
> Hello
>
> I have resolved ..this probleme It was a probleme linked with micrsoft
> object librairies...
>
> I have succeed creating my MenuBarr BUT i dont know How to put mu
> MenuBarr Inside MY FORM and not showing it inside STANDAR ACCESS Menus
>
> Could you help me?

Access forms do not support embedded menus or tool-bars. These always
live in the main Access window.

You can fake it by using labels that display shortcut menus or perform
actions when clicked.



--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Re: How To Create MenuCommand Bar by VBA
"kapusta117 via AccessMonster.com" <u47866[ at ]uwe> 11/30/2008 7:21:13 PM
Helllo

THANK YOU
I have juste Realized this ...AS YOU SEE i could USE LABELS....i realized
that MY WAS at INDEPANDANT WINDOW...that s normal that The created VBA
COMMANDBAR is hideen...

SO i just now change the format of my form SO the Menubar is shown just at
the top ( at same time i hide the others standard Access MenuBar) ....Rother
THAN using Lable AS you said....


NOW ALLTHING ARE OKEY ...I HAVE changed the height and the width OF my
toolbar (commanbar)
like THAT :
Set cmb = Application.CommandBars.Add("MaBarre", msoBarTop, True, True)



' ===== ajout de boutons =====
Set btn = cmb.Controls.Add(msoControlButton)
With btn
.Caption = "&Bouton 1"
.Style = msoButtonCaption
.Height = 60
.Width = 200
End With
Set btn = cmb.Controls.Add(msoControlButton)
With btn
.Caption = "B&outon 2"
.Style = msoButtonCaption
.Height = 60
.Width = 200

End With


BUT i dont find the PROPERTY that allow me change the size OF the texte
caption of the button

something like .SIZE=15 SO the width and height of my commandBar COULD
FIT with the texte inside


THank youu veryy Much

--
Message posted via http://www.accessmonster.com

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net