ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 13561|回复: 19

[分享] 分享一个ppt链接对象路径批量更改的方法

[复制链接]

TA的精华主题

TA的得分主题

发表于 2017-9-14 15:00 | 显示全部楼层 |阅读模式
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
在制作ppt时, 经常会用到粘贴->选择性粘贴->工作表对象的功能来实现"当链接的表格数据更改时, PPT数据也同步更新", 此功能能很大程度上提高ppt的制作效率, 但当一个月完结, 需要将整套ppt+excel打包应用至新路径时, ppt链接的表格文件仍然为原来的路径, 这时则需要通过手工逐个更改源文件的功能来实现, 如果链接的表格非常多, 这就需要花费大量的时间来修改且容易出错, 因此可通过附件的方法来批量修改

7-ppt链接对象路径批量更改方法 V1.zip

540.68 KB, 下载次数: 1764

TA的精华主题

TA的得分主题

发表于 2017-10-2 19:10 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
感谢分享经验,可惜ppt没有alt+f9显示域代码那种功能,不然就方便多了。

TA的精华主题

TA的得分主题

发表于 2017-10-24 11:38 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2018-3-29 17:34 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2018-9-12 21:08 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
Search & Replace to change OLE link paths
Problem

Suppose you've got a lot of links in a PPT file or files and all the links point to a network share.

Then somebody comes along and installs a new server with a new name. Maybe they copy all of your files to the new server, but all of your links break because they point to \\OldServer\YourPath\ but the files are now on \\NewServer\YourPath\

Solution

This little macro will look for all of the OLE links in your presentation and change \\OldServer\ to \\NewServer\ (and if the folder names changed, it'll fix that too).

You'll need to edit the paths it searches for and replaces where indicated below.

Please run this only on a COPY of your important presentation files. Note that you won't see any changes until you save the presentation then re-open it and allow PowerPoint to update the links. We could force it to update immediately but that'd slow it down considerably.

Sub ChangeOLELinks()
' Note: this will only work in PPT 2000 and later

    Dim oSld As Slide
    Dim oSh As Shape
    Dim sOldPath As String
    Dim sNewPath As String

    ' EDIT THIS TO REFLECT THE PATHS YOU WANT TO CHANGE
    ' Include just the portion of the path you want to change
    ' For example, to change links to reflect that files have moved from
    ' \\boss\p-drive\temp\*.* to
    ' \\boss\Q-drive\temp\*.*
    sOldPath = "\\boss\p-drive\"
    sNewPath = "\\boss\q-drive\"

    On Error GoTo ErrorHandler

    For Each oSld In ActivePresentation.Slides
        For Each oSh In oSld.Shapes
            ' Change only linked OLE objects
            If oSh.Type = msoLinkedOLEObject Then
                On Error Resume Next
                ' Verify that file exists
                If Len(Dir$(Replace(oSh.LinkFormat.SourceFullName, sOldPath, sNewPath))) > 0 Then
                     oSh.LinkFormat.SourceFullName = Replace(oSh.LinkFormat.SourceFullName, sOldPath, sNewPath)
                Else
                      MsgBox("File is missing; cannot relink to a file that isn't present")
                End If
                On Error GoTo ErrorHandler
             End If
        Next    ' shape
    Next    ' slide

    MsgBox("Done!")

NormalExit:
    Exit Sub
ErrorHandler:
    MsgBox("Error " & err.number & vbcrlf & err.description)
    Resume NormalExit

End Sub

TA的精华主题

TA的得分主题

发表于 2018-9-15 09:22 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2019-4-4 12:44 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2019-9-11 17:17 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
非常感谢,这个成功解决了我的问题,谢谢!!

TA的精华主题

TA的得分主题

发表于 2019-10-25 22:02 | 显示全部楼层
你好,我有一个问题困扰了我很久,就是用vba按钮实现PPT里的表格,图表的数据更新,有实现的可能吗?谢谢!

TA的精华主题

TA的得分主题

发表于 2019-12-12 11:44 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

关闭

最新热点上一条 /1 下一条

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-4-19 04:06 , Processed in 0.046379 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表