求Excel快速访问工具栏<<< >>> ABC图标文件名及相关图标名称
Hey there! I’ve run into this exact issue before when building custom ribbons for Excel, so I can help you out here.
你要找的<<< >>> ABC图标名称
那个带有<<< >>>和ABC的缩放滑块图标,对应的内置名称是"ZoomSlider"。你可以直接在你的VBA代码里这样调用:
Case "YourButtonID": RibbonImage = "ZoomSlider"
获取所有快速访问工具栏(QAT)内置图标名称的方法
Since Google doesn’t always list these clearly, here are two reliable ways to pull all built-in icon names, including every one available in the QAT:
方法1:用VBA代码批量导出
Run this simple VBA macro, and it will create a new worksheet with every built-in control’s ID, icon name, and caption:
Sub ListAllBuiltInIcons() Dim cmdBar As CommandBar Dim cmdBarCtrl As CommandBarControl Dim ws As Worksheet Dim rowNum As Integer ' Create a new sheet to store results Set ws = ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) ws.Name = "BuiltInIconList" ' Set header rows ws.Range("A1").Value = "Control ID" ws.Range("B1").Value = "Icon Name" ws.Range("C1").Value = "Control Caption" rowNum = 2 ' Loop through all command bars and controls For Each cmdBar In Application.CommandBars For Each cmdBarCtrl In cmdBar.Controls If Not cmdBarCtrl.Picture Is Nothing Then ws.Range("A" & rowNum).Value = cmdBarCtrl.ID ws.Range("B" & rowNum).Value = cmdBarCtrl.Picture.Name ws.Range("C" & rowNum).Value = cmdBarCtrl.Caption rowNum = rowNum + 1 End If Next cmdBarCtrl Next cmdBar ' Format the sheet for readability ws.Columns("A:C").AutoFit MsgBox "Icon list generated successfully!", vbInformation End Sub
Once you run this, you’ll have a complete list of every built-in icon name Excel uses—including all QAT icons—to reference in your ribbon code.
方法2:使用Office Custom UI Editor
If you’re using the Custom UI Editor for Office (a go-to tool for building custom ribbons), you can easily find icon names by:
- Opening your Excel file in the editor
- Clicking the "Insert Icon" button in the toolbar
- Hovering over any icon—its internal name will show up in a tooltip
This is super handy if you just need to look up a specific icon quickly without running code.
A quick note: Some icons have size-specific variants (like ZoomSlider_16x16 or ZoomSlider_32x32), but using the base name (like ZoomSlider) will usually work across different ribbon sizes.
内容的提问来源于stack exchange,提问作者SQALEX101

