|
本帖最后由 鱼儿游游 于 2011-11-16 14:32 编辑
下面的代码能生成一项菜单,缺点是要先引用:Microsoft office 11.0 Object library对象库
Dim iBar As CommandBar
Dim iButton As CommandBarButton
Dim iCombo As CommandBarComboBox
Set iBar = Application.CommandBars.Add(Name:=("menuTreeView"), Position:=msoBarPopup, Temporary:=True)
With iBar
Set iButton = .Controls.Add(Type:=msoControlButton)
iButton.Caption = "增加 选定节点子节点(&A)"
iButton.OnAction = "Get_PopupMenuSelection"
iButton.Tag = "ADD"
iButton.FaceId = 240
End with
求助问题:不用先引用Microsoft office 11.0 Object library对象库,代替上述代码中的变量定义?
类似定义ADO记录一样:
用
DIM rst As Object
Set rst = CreateObject("ADODB.Recordset")
代替:
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
|
|