【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中,开发工具 → 宏 → 运行
相关推荐
Yan-英杰16 小时前
从零玩转搜索引擎 API: 多引擎整合实战
服务器·前端·microsoft
步步为营DotNet16 小时前
Blazor 在边缘计算客户端应用中的创新实践与深度解析
人工智能·microsoft·边缘计算
小鹿软件办公18 小时前
微软为 Windows 10、11 及 Server 安装镜像发布 Defender 更新
microsoft·defender
小刘的干货分享19 小时前
微软必应搜索推广:触达高价值决策层的PC端独占流量
microsoft·搜索引擎·微软
薛定猫AI19 小时前
【技术干货】DeepSeek 桌面智能体应用全解析:开源 AI Agent 平台实战部署与 API 调用指南
人工智能·microsoft
tedcloud12319 小时前
Understand-Anything部署教程:打造AI代码理解平台
服务器·人工智能·学习·自动化·powerpoint
AIHR数智引擎21 小时前
AI组织进化论:拆解微软、英伟达、Anthropic与Open AI如何重写组织
人工智能·经验分享·microsoft·职场和发展·aihr
OPMR1 天前
【已解决】微软输入法输入英文间隔变大(微软全字符切换)
程序人生·microsoft
技术钱1 天前
langGraph基础组件介绍(二)
microsoft
影寂ldy2 天前
C# 索引器(Indexer)超全笔记【基础 + 重载 + 实战练习】
windows·microsoft