- 帖子
- 258
- 主題
- 77
- 精華
- 0
- 積分
- 385
- 點名
- 0
- 作業系統
- Win7
- 軟體版本
- Office2010
- 閱讀權限
- 20
- 性別
- 男
- 來自
- Taiwan
- 註冊時間
- 2010-8-8
- 最後登錄
- 2021-1-25
|
[發問] 在命令列中增加Control卻無法呈現 .Caption ?
本帖最後由 yangjie 於 2014-7-14 18:00 編輯
請教大大先進們
跑完下列 製出一個CommandBarControl在命令列中
卻無法呈現 .Caption = "回主選單"
求救
Sub MakeMenu1()
Dim bar As CommandBarControl
Dim NewMenu1 As CommandBarControl
Dim MenuCount As Integer
Dim i As Integer
For Each bar In Application.CommandBars(1).Controls
bar.Visible = False
Next
On Error Resume Next
Application.CommandBars(1).Controls("回主選單").Delete
On Error GoTo 0
MenuCount = Application.CommandBars(1).Controls.Count
Set NewMenu1 = Application.CommandBars(1).Controls.Add(Type:=msoControlButton, before:=MenuCount, Temporary:=True)
With NewMenu1
.Caption = "回主選單"
.OnAction = "myForm1"
End With
End Sub
錯誤在哪?
若欲再增加2個Controls 又如何增寫? |
|