You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

新增VBA宏及自定义Ribbon XML后PPT Ribbon无法正常访问问题求助

PPT自定义Ribbon新增宏后工具栏无响应问题

我在自定义PPT工具栏中新增了一个宏后,出现了整个PPT Ribbon无法访问的问题:Ribbon仅在首次打开时可正常使用,运行该新增宏后,所有PPT Ribbon控件均停止响应。我已确认该问题是在使用自定义Ribbon XML添加功能项后触发的,请问是否支持上传pptm文件供排查,我后续会附上对应文件,感谢协助。

新增按钮对应的Ribbon XML代码

<button id="btnUnifyIcons2"
        label="Unify Icons"
        imageMso="DataGraphicIconSet"
        supertip="Converts the selected icons/groups/shapes into default ZEN icons and Liberty Mutual icons for Constructs creation."
        onAction="Module1.ShowUnifyIconForm"  /> 

新增的宏代码

Sub ShowUnifyIconForm()
    frmUnifyIcons.Show
End Sub

Sub unifyIconOptions(iconType As String)
    If Not icw_CheckReg Then Exit Sub

    Dim shp, shpNew, objShp As Shape
    Dim shpNum, iRem As Integer

    shpNum = 1
    'Dim strFilepath, strExtn As String
    'strFilepath = "C:\Zen\ZenPic"
    'strExtn = ".jpg"
    Dim oSource As Presentation
    '
    For Each shp In ActiveWindow.Selection.ShapeRange
        iRem = shpNum Mod 8
        If iRem = 0 Then iRem = 8

        If shp.Type = msoGroup Or shp.Type = msoAutoShape Or shp.Type = msoFreeform Or shp.Type = 28 Or shp.Type = msoPicture Then
            Set oSource = Presentations.Open("C:\Zen\ZenLibrary.pptx", msoFalse, msoFalse, msoTrue)
            oSource.Slides(1).Shapes(iconType & iRem).Copy
            oSource.Close
            With ActivePresentation.Slides(ActiveWindow.Selection.SlideRange.SlideIndex)
                .Shapes.Paste
                With .Shapes(.Shapes.Count)
                    .Left = shp.Left
                    .Top = shp.Top
                    .LockAspectRatio = msoTrue
                    .Height = shp.Height
                    .Width = shp.Width
                End With
            End With
            shp.Delete

        End If
        shpNum = shpNum + 1
    Next

End Sub

frmunifyIcons窗体代码

Private Sub cmdApply_Click()
    Dim iType As String
    If ZenIcon.Value Then
        iType = "ZenIcon"
    ElseIf LibertyBlueIcon.Value Then
        iType = "LibertyBlueIcon"
    ElseIf LibertyWhiteIcon.Value Then
        iType = "LibertyWhiteIcon"
    End If
    unifyIconOptions (iType)
    Unload Me
End Sub

问题现象截图

问题现象截图


内容的提问来源于stack exchange,提问作者Jegan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 02:45:04