Youssef-
You must load a reference to the Office library in Tools / References.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Youssef
Sent: Thursday, April 04, 2013 10:23 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] CommandBar
Dear All,
I try to implement the next code for creating my own menu the problem the
when i type
Dim cmb as commandbar
the popup menu containing these command does not contains "commandbar"
what it the problem?
is there a missing refrence? how i can get it
thanks for your usual support.
the complete code is :
Option Compare Database
Option Explicit
----------------------------------------------------------
Public Function CreateCMenu()
On Error Resume Next
CommandBars("MyContext").Delete
Dim cmb As CommandBar
Set cmb = CommandBars.Add("MyContext", _
msoBarPopup, False, False)
With cmb
.Controls.Add msoControlButton, _
21, , , True ' Cut
.Controls.Add msoControlButton, _
19, , , True ' Copy
.Controls.Add msoControlButton, _
22, , , True ' Paste
End With
End Function
Public Function CreateCMenu1()
On Error Resume Next
CommandBars("MyContext1").Delete
Dim cmb As CommandBar
Dim cmbBtn1 As CommandBarButton
Dim cmbBtn2 As CommandBarButton
Dim cmbBtn3 As CommandBarButton
Set cmb = CommandBars.Add("MyContext1", _
msoBarPopup, False, False)
With cmb
Set cmbBtn1 = .Controls.Add(msoControlButton, _
, , , True)
With cmbBtn1
.Caption = "My Button 1"
.OnAction = "=fncOnActionBtn1()"
End With
Set cmbBtn2 = .Controls.Add(msoControlButton, _
, , , True)
With cmbBtn2
.Caption = "My Button 2"
.OnAction = "=fncOnActionBtn2()"
End With
Set cmbBtn3 = .Controls.Add(msoControlButton, _
, , , True)
With cmbBtn3
.Caption = "My Button 3"
.OnAction = "=fncOnActionBtn3()"
.BeginGroup = True
.FaceId = 59
End With
End With
End Function
Public Function fncOnActionBtn1()
MsgBox "Button 1", vbInformation
End Function
Public Function fncOnActionBtn2()
MsgBox "Button 2", vbInformation
End Function
Public Function fncOnActionBtn3()
MsgBox "Button 3", vbInformation
End Function
----------------------------------------------------------
[Non-text portions of this message have been removed]
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar