|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
大家好~
我自己创建了一个菜单栏,但想点击菜单,会调用输入参数的函数,目前试了好多方法不成功。
请高手指点下~
谢谢~
'ctrl1.OnAction = "ShowForm1"
Sub createMenu()
Dim myMenuBar As CommandBar
Dim newMenu As CommandBarPopup
Dim ctrl1 As CommandBarButton
'初始化菜单
Set myMenuBar = Application.ActiveDocument.CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "值班记事"
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "提取上班"
ctrl1.Style = msoButtonIconAndCaption
ctrl1.FaceId = 2109
ctrl1.OnAction = "ShowForm1"
ctrl1.Visible = True
End Sub
Sub ShowForm1(i_msg As String)
MsgBox i_msg
End Sub
|
|