- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
6#
發表於 2018-4-10 09:38
| 只看該作者
本帖最後由 GBKEE 於 2018-4-10 09:39 編輯
回復 5# PKKO
2010 版- Option Explicit
- Sub Ex()
- Dim i, ii, x, e
- For i = 1 To Application.CommandBars.Count
- If Application.CommandBars(i).Type = msoBarTypePopup Then
- x = x + 1
- Cells(x, 1) = Application.CommandBars(i).Name
- Cells(x, 2) = Application.CommandBars(i).NameLocal
- Cells(x, 3) = Application.CommandBars(i).ID
- ii = 1
- For Each e In Application.CommandBars(i).Controls
- If InStr(e.Caption, "刪除(&D)...") Then
- Cells(x, ii + 3) = e.Caption
- Cells(x, ii + 4) = e.ID
- End If
- Next
- End If
- Next
- End Sub
- Sub Ex1()
- Dim Bar As CommandBarControls, xId As Integer, A As Variant
- xId = 292 '293,294 看看是哪一個id
- Application.CommandBars.FindControls(ID:=xId).Item(1).Enabled = False
- Set Bar = Application.CommandBars.FindControls(ID:=xId)
- '************************應證 EX程式 Id = 292,293,294 找到的 "刪除(&D)..."
- For Each A In Application.CommandBars.FindControls(ID:=xId)
- Debug.Print A.Caption, A.ID
- Next
- '*********************
- Stop '看是否已停止使用
- Application.CommandBars.FindControls(ID:=xId).Item(1).Enabled = True '恢復使用
- End Sub
- Sub Exe()
- Application.CommandBars("CELL").Reset
- End Sub
複製代碼 |
|