Sub 获取所有CommandBarID()
Dim wdApp As Object ' Word.Application
Dim cb As Object ' CommandBar
Dim s As String, id As String
Set wdApp = CreateObject("Word.Application")
With wdApp
.Visible = True
.Documents.Add ' 新建Word文档
For Each cb In .CommandBars
s = cb.Name
id = cb.id
Debug.Print "CommandBar名称: " & s & ", ID: " & id
Next cb
Set wdApp = Nothing
End With
MsgBox "已获取所有CommandBar ID"
End Sub
CommandBar名称: Diagram, ID: 1435
CommandBar名称: Reviewing, ID: 142
CommandBar名称: AutoSummarize, ID: 537
CommandBar名称: Exit Design Mode, ID: 502
CommandBar名称: Control Toolbox, ID: 244
CommandBar名称: Text Box, ID: 530
CommandBar名称: Outlook Read Mail, ID: 589
CommandBar名称: Outlook Send Mail, ID: 588
CommandBar名称: Function Key Display, ID: 1028
CommandBar名称: Web Tools, ID: 1089
CommandBar名称: Word Count, ID: 1424
CommandBar名称: Japanese Greetings, ID: 1495
CommandBar名称: Menu Bar, ID: 37
CommandBar名称: Refresh, ID: 159
CommandBar名称: Frames, ID: 1085
CommandBar名称: E-mail, ID: 1682
CommandBar名称: Full Screen Reading, ID: 1710
CommandBar名称: Document Layout, ID: 1973
CommandBar名称: Compare Side by Side, ID: 1888
CommandBar名称: Ink Drawing and Writing, ID: 1931
CommandBar名称: Ink Annotations, ID: 1932
CommandBar名称: Ink Comment, ID: 1992
CommandBar名称: Style Inspector, ID: 2133
CommandBar名称: &Legacy Keyboard Support, ID: 2385
CommandBar名称: Format Object, ID: 2490
CommandBar名称: Selection, ID: 2202
CommandBar名称: Task Pane, ID: 1423
CommandBar名称: , ID: 1826
CommandBar名称: Property Editor, ID: 2089
CommandBar名称: Office Clipboard, ID: 2095
CommandBar名称: XML Source, ID: 1690
CommandBar名称: Research, ID: 1725
CommandBar名称: XML Document, ID: 1893
CommandBar名称: Signatures, ID: 2087
CommandBar名称: Document Actions, ID: 1788
CommandBar名称: Clip Art, ID: 1521
CommandBar名称: Reading Order, ID: 3108
CommandBar名称: Document Management, ID: 1862
CommandBar名称: Document Updates, ID: 1776
CommandBar名称: Mail Merge Panes, ID: 2215
CommandBar名称: Fax Service, ID: 1820
CommandBar名称: Meeting Workspace, ID: 1777
CommandBar名称: Attachment Options, ID: 1749
CommandBar名称: Accessibility, ID: 2440
CommandBar名称: Editor, ID: 2472
CommandBar名称: Dictionaries, ID: 3001
CommandBar名称: Thesaurus, ID: 3017
CommandBar名称: History, ID: 3038
CommandBar名称: Share, ID: 3040
CommandBar名称: Smart Lookup, ID: 3039
CommandBar名称: Version History, ID: 3047
CommandBar名称: Researcher, ID: 3049
CommandBar名称: Insert From File, ID: 3050
CommandBar名称: Help, ID: 3053
CommandBar名称: Online Content, ID: 3057
CommandBar名称: Alt Text, ID: 3064
CommandBar名称: Feedback, ID: 3070
CommandBar名称: Data Selector, ID: 3074
CommandBar名称: Comments, ID: 3080
CommandBar名称: Contact Support, ID: 3097
CommandBar名称: Troubleshooter, ID: 3098
CommandBar名称: Activity, ID: 3095
CommandBar名称: Admin Tenant Portal, ID: 3103
CommandBar名称: Notifications, ID: 3104
CommandBar名称: User Voice, ID: 3105
CommandBar名称: Search Feedback, ID: 3107
CommandBar名称: Do more with Surface, ID: 3111
CommandBar名称: Outlook Room Finder Pane, ID: 3113
CommandBar名称: Outlook Meeting Insights Pane, ID: 3115
CommandBar名称: Outlook Notifications Pane, ID: 3120
CommandBar名称: Diagnostic Pane, ID: 3121
CommandBar名称: Diagnostic Pane, ID: 3122
CommandBar名称: Diagnostic Pane, ID: 3123
CommandBar名称: Diagnostic Pane, ID: 3124
CommandBar名称: Data Types Refresh Settings, ID: 3125
CommandBar名称: Outlook My Day Pane, ID: 3126
CommandBar名称: Changes, ID: 3130
CommandBar名称: Outlook FindTime Pane, ID: 3135
CommandBar名称: Unsaved Changes, ID: 3136
CommandBar名称: Workbook Performance, ID: 3140
CommandBar名称: Excel Task Pane, ID: 3141
CommandBar名称: Workbook Links, ID: 3147
CommandBar名称: Diagnostics, ID: 3152
CommandBar名称: Python in Excel, ID: 3153
CommandBar名称: Hello AI, ID: 3157
CommandBar名称: Accessibility Assistant, ID: 3158
CommandBar名称: Advertisement Pane, ID: 3160
CommandBar名称: , ID: 1
CommandBar名称: , ID: 1
CommandBar名称: , ID: 1
CommandBar名称: Chinese Translation, ID: 1090
CommandBar名称: Drop Caps, ID: 55
CommandBar名称: Endnotes, ID: 56
CommandBar名称: Fields, ID: 57
CommandBar名称: Display Fields, ID: 58
CommandBar名称: Field Display List Numbers, ID: 954
CommandBar名称: Form Fields, ID: 59
CommandBar名称: Footnotes, ID: 60
CommandBar名称: Frames, ID: 61
CommandBar名称: Headings, ID: 62
CommandBar名称: Linked Headings, ID: 63
CommandBar名称: Script Anchor Popup, ID: 984
CommandBar名称: Lists, ID: 64
CommandBar名称: Inline Picture, ID: 156
CommandBar名称: Inline Canvas, ID: 1482
CommandBar名称: Horizontal Line Popup, ID: 985
CommandBar名称: Tables, ID: 66
CommandBar名称: Table Cells, ID: 67
CommandBar名称: Table Headings, ID: 68
CommandBar名称: Table Lists, ID: 69
CommandBar名称: Table Pictures, ID: 70
CommandBar名称: Table Text, ID: 71
CommandBar名称: Whole Table, ID: 72
CommandBar名称: Linked Table, ID: 73
CommandBar名称: Text, ID: 74
CommandBar名称: Word Previewer, ID: 2145
CommandBar名称: Linked Text, ID: 75
CommandBar名称: Font Popup, ID: 77
CommandBar名称: Font Paragraph, ID: 78
CommandBar名称: Format Inspector Popup in Normal Mode, ID: 1597
CommandBar名称: Format Inspector Popup in Compare Mode, ID: 1598
CommandBar名称: Spelling, ID: 79
CommandBar名称: Grammar, ID: 102
CommandBar名称: Grammar (2), ID: 1041
CommandBar名称: Format consistency, ID: 1493
CommandBar名称: Background Proofing Status Bar, ID: 957
CommandBar名称: Track Changes, ID: 542
CommandBar名称: Frame Properties, ID: 161
CommandBar名称: Hyperlink Context Menu, ID: 545
CommandBar名称: AutoSignature Popup, ID: 988
CommandBar名称: Field AutoText, ID: 144
CommandBar名称: Document Map, ID: 953
CommandBar名称: Shapes, ID: 54
CommandBar名称: Curve, ID: 232
CommandBar名称: Curve Node, ID: 233
CommandBar名称: Curve Segment, ID: 234
CommandBar名称: Floating Picture, ID: 157
CommandBar名称: Canvas Popup, ID: 1440
CommandBar名称: OLE Object, ID: 235
CommandBar名称: ActiveX Control, ID: 598
CommandBar名称: WordArt Context Menu, ID: 237
CommandBar名称: Rotate Mode, ID: 238
CommandBar名称: Comment, ID: 543
CommandBar名称: Organization Chart Popup, ID: 1434
CommandBar名称: Diagram, ID: 1039
CommandBar名称: Connector, ID: 236
CommandBar名称: Track Changes Indicator, ID: 544
CommandBar名称: Address Block Popup, ID: 1594
CommandBar名称: Greeting Line Popup, ID: 1595
CommandBar名称: Barcode Merge Field Popup, ID: 3010
CommandBar名称: Inline ActiveX Control, ID: 1096
CommandBar名称: Word CoAuthoring, ID: 2451
CommandBar名称: XML Error Options, ID: 1858
CommandBar名称: Ink Comment, ID: 2004
CommandBar名称: Business Card, ID: 2272
CommandBar名称: Equation Popup, ID: 2360
CommandBar名称: Header Area Popup, ID: 2343
CommandBar名称: Footer Area Popup, ID: 2344
CommandBar名称: Text, ID: 2374
CommandBar名称: Tables, ID: 2375
CommandBar名称: Table Cells, ID: 2376
CommandBar名称: Table Lists, ID: 2377
CommandBar名称: Table Pictures, ID: 2378
CommandBar名称: Table Text, ID: 2379
CommandBar名称: Whole Table, ID: 2380
CommandBar名称: Linked Table, ID: 2381
CommandBar名称: Lists, ID: 2382
CommandBar名称: Hyperlink Context Menu, ID: 2383
CommandBar名称: Word Page Numbering Options, ID: 2431
CommandBar名称: AutoShapes, ID: 4273
CommandBar名称: Callouts, ID: 4275
CommandBar名称: Flowchart, ID: 4276
CommandBar名称: Block Arrows, ID: 4277
CommandBar名称: Stars & Banners, ID: 4278
CommandBar名称: Lines, ID: 4250
CommandBar名称: Basic Shapes, ID: 4274
CommandBar名称: Connectors, ID: 4629
CommandBar名称: Fill Color, ID: 4242
CommandBar名称: Insert Shape, ID: 5742
CommandBar名称: Line Color, ID: 4243
CommandBar名称: Drawing and Writing Pens, ID: 5985
CommandBar名称: Annotation Pens, ID: 6029
CommandBar名称: Drawing and Writing Pens, ID: 6154
CommandBar名称: Annotation Pens, ID: 6153
CommandBar名称: Align or Distribute, ID: 4607
CommandBar名称: Rotate or Flip, ID: 4234
CommandBar名称: Order, ID: 4231
CommandBar名称: Nudge, ID: 4271
CommandBar名称: Borders, ID: 4107
CommandBar名称: Font Color, ID: 4481
CommandBar名称: Shading Color, ID: 5048
CommandBar名称: Cell Alignment, ID: 5139
CommandBar名称: Text Wrapping, ID: 4297
CommandBar名称: Clipboard, ID: 983
CommandBar名称: Envelope, ID: 1030
CommandBar名称: System, ID: 193
CommandBar名称: Business Bar, ID: 2149
CommandBar名称: Status Bar, ID: 2086
CommandBar名称: Ribbon, ID: 2099
标签:VBA,Popup,Word,CommandBar,名称,Pane,Table,ID From: https://www.cnblogs.com/guangzhiruijie/p/17695903.html