【Microsoft 365可用】PPT一键取消所有超链接

删除或禁用超链接 - Microsoft 支持从页面中删除一个或多个超链接,或在键入时关闭自动超链接创建。https://support.microsoft.com/zh-cn/office/%E5%88%A0%E9%99%A4%E6%88%96%E7%A6%81%E7%94%A8%E8%B6%85%E9%93%BE%E6%8E%A5-027b4e8c-38f8-432c-b57f-6c8b67ebe3b0 微软官方给出的方法并不适用于PowerPoint,而PowerPoint中的宏也没有Hyperlinks这个属性,经实际验证,使用下面的宏指令可以一键移除幻灯片中全部的超链接。

vbscript 复制代码
'最简单有效的版本
Sub RemoveHyperlinksEasy()
    
    Dim sld As Slide
    Dim shp As Shape
    Dim count As Integer
    
    count = 0
    
    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
            
            '删除形状上的超链接
            On Error Resume Next
            If shp.ActionSettings(ppMouseClick).Hyperlink.Address <> "" Then
                shp.ActionSettings(ppMouseClick).Hyperlink.Address = ""
                count = count + 1
            End If
            On Error GoTo 0
            
            '删除文本中的超链接格式
            If shp.HasTextFrame Then
                If shp.TextFrame.HasText Then
                    On Error Resume Next
                    shp.TextFrame.TextRange.ActionSettings(ppMouseClick).Action = ppActionNone
                    shp.TextFrame.TextRange.ActionSettings(ppMouseClick).Hyperlink.Address = ""
                    count = count + 1
                    On Error GoTo 0
                End If
            End If
            
        Next shp
    Next sld
    
    MsgBox "处理完成!删除了 " & count & " 个超链接", vbInformation
    
End Sub

如何使用这个宏:

1. 打开VBA编辑器

  • 在PowerPoint中按 Alt + F11
  • 或者:文件 → 选项 → 自定义功能区 → 勾选"开发工具" → 开发工具 → Visual Basic

2. 插入宏代码

  • 在VBA编辑器中,右键点击左侧的项目
  • 选择 插入 → 模块
  • 将上面的代码复制粘贴到模块中

3. 运行宏

  • F5 运行宏
  • 或者:在PowerPoint中,开发工具 → 宏 → 运行
相关推荐
hunteritself1 天前
反击 OpenAI!谷歌史诗级更新:Gemini in Chrome 正式上线,免费用
人工智能·深度学习·microsoft·机器学习·chatgpt
Blossom.1181 天前
从视觉理解到自主决策:多模态大模型与AI Agent融合架构实战解析
数据库·人工智能·python·深度学习·microsoft·机器学习·架构
kaka.liulin -study2 天前
EmberTrace AI | NoteBook Mode :DeepPPT Gen 智能PPT生成
人工智能·语言模型·powerpoint
Studying 开龙wu2 天前
争对C++开发VS2022安装——Microsoft Visual Studio2022从下载到安装步骤教程(超详细)
c++·microsoft·visual studio
珊瑚怪人2 天前
Microsoft Visual Studio2022下载安装详细教程
ide·microsoft·c#·编辑器·visual studio·cpp
小爷毛毛(卓寿杰)2 天前
SlideFlow: AI 驱动的 PPT 自动化生成引擎
人工智能·自动化·powerpoint·大语言模型
LAM LAB2 天前
【VBA/ppt】设置选中字体为红色
powerpoint·vba·wps
weixin_456907412 天前
使用 html为 ppt 文档添加文本像素格的实用方法
html·tensorflow·powerpoint
老兵发新帖2 天前
技术架构图drawio到PPT
powerpoint·draw.io
满栀5852 天前
企业后台管理系统菜单模块重构
microsoft·重构