如何在 PowerPoint 中创建动态超链接?
How do I create dynamic hyperlinks in powerpoint?
我正在尝试 link 对 excel 中的数据进行 powerpoint 演示。但是 excel 和 powerpoint 每天都会改变位置。
到目前为止,这是我的方法:
- 复制自 excel
- 特殊粘贴...粘贴link...作为:Microsoft Excel 工作表(代码)对象
这让我可以实时编辑 excel 文档和实时更新 powerpoint。
但是,当我更改 excel 文档的位置时,所有 100+ link 都损坏了。
如何动态设置 link 的路径,使它们始终遵循正确的 excel 文档,无论 excel 文档位于何处? excel 文档永远不会更名,powerpoint 也不会。
我已经找了 6 个多月的解决方案...
谢谢。
您可以 link 保存的 Excel 电子表格中的数据或将 Excel 电子表格中的单元格复制到您的 Microsoft PowerPoint 2010 演示文稿中。
我的 PPTFAQ 网站上有一个页面包含可能有用的代码:
超链接、OLE 链接、电影链接和声音链接的批量搜索和替换
http://www.pptfaq.com/FAQ00773_Batch_Search_and_Replace_for_Hyperlinks-_OLE_links-_movie_links_and_sound_links.htm
这是具体代码...它处理超链接和 OLE 链接(即您的 Excel 链接)。如果不需要,可以删除超链接内容并将新路径作为参数传递,而不是从 InputBox 获取它:
Sub HyperLinkSearchReplace()
Dim oSl As Slide
Dim oHl As Hyperlink
Dim sSearchFor As String
Dim sReplaceWith As String
Dim oSh As Shape
sSearchFor = InputBox("What text should I search for?", "Search for ...")
If sSearchFor = "" Then
Exit Sub
End If
sReplaceWith = InputBox("What text should I replace" & vbCrLf _
& sSearchFor & vbCrLf _
& "with?", "Replace with ...")
If sReplaceWith = "" Then
Exit Sub
End If
On Error Resume Next
For Each oSl In ActivePresentation.Slides
For Each oHl In oSl.Hyperlinks
oHl.Address = Replace(oHl.Address, sSearchFor, sReplaceWith)
oHl.SubAddress = Replace(oHl.SubAddress, sSearchFor, sReplaceWith)
Next ' hyperlink
' and thanks to several astute user suggestions, let's fix OLE links
' and movie/sound linkes too
For Each oSh In oSl.Shapes
If oSh.Type = msoLinkedOLEObject _
Or oSh.Type = msoMedia Then
oSh.LinkFormat.SourceFullName = _
Replace(oSh.LinkFormat.SourceFullName, _
sSearchFor, sReplaceWith)
End If
Next
Next ' slide
End Sub
使用“公式”中的“名称管理器”功能,定义要在 PowerPoint 中粘贴的 table/certain 个单元格的名称。
这样当你在PPT上粘贴“Excel对象”时,link将不仅仅是table在工作表中的位置(类似于R1C1),而是您定义的名称,如果您移动 table 将不会受到影响。
我正在尝试 link 对 excel 中的数据进行 powerpoint 演示。但是 excel 和 powerpoint 每天都会改变位置。
到目前为止,这是我的方法: - 复制自 excel - 特殊粘贴...粘贴link...作为:Microsoft Excel 工作表(代码)对象
这让我可以实时编辑 excel 文档和实时更新 powerpoint。
但是,当我更改 excel 文档的位置时,所有 100+ link 都损坏了。
如何动态设置 link 的路径,使它们始终遵循正确的 excel 文档,无论 excel 文档位于何处? excel 文档永远不会更名,powerpoint 也不会。
我已经找了 6 个多月的解决方案... 谢谢。
您可以 link 保存的 Excel 电子表格中的数据或将 Excel 电子表格中的单元格复制到您的 Microsoft PowerPoint 2010 演示文稿中。
我的 PPTFAQ 网站上有一个页面包含可能有用的代码:
超链接、OLE 链接、电影链接和声音链接的批量搜索和替换 http://www.pptfaq.com/FAQ00773_Batch_Search_and_Replace_for_Hyperlinks-_OLE_links-_movie_links_and_sound_links.htm
这是具体代码...它处理超链接和 OLE 链接(即您的 Excel 链接)。如果不需要,可以删除超链接内容并将新路径作为参数传递,而不是从 InputBox 获取它:
Sub HyperLinkSearchReplace()
Dim oSl As Slide
Dim oHl As Hyperlink
Dim sSearchFor As String
Dim sReplaceWith As String
Dim oSh As Shape
sSearchFor = InputBox("What text should I search for?", "Search for ...")
If sSearchFor = "" Then
Exit Sub
End If
sReplaceWith = InputBox("What text should I replace" & vbCrLf _
& sSearchFor & vbCrLf _
& "with?", "Replace with ...")
If sReplaceWith = "" Then
Exit Sub
End If
On Error Resume Next
For Each oSl In ActivePresentation.Slides
For Each oHl In oSl.Hyperlinks
oHl.Address = Replace(oHl.Address, sSearchFor, sReplaceWith)
oHl.SubAddress = Replace(oHl.SubAddress, sSearchFor, sReplaceWith)
Next ' hyperlink
' and thanks to several astute user suggestions, let's fix OLE links
' and movie/sound linkes too
For Each oSh In oSl.Shapes
If oSh.Type = msoLinkedOLEObject _
Or oSh.Type = msoMedia Then
oSh.LinkFormat.SourceFullName = _
Replace(oSh.LinkFormat.SourceFullName, _
sSearchFor, sReplaceWith)
End If
Next
Next ' slide
End Sub
使用“公式”中的“名称管理器”功能,定义要在 PowerPoint 中粘贴的 table/certain 个单元格的名称。
这样当你在PPT上粘贴“Excel对象”时,link将不仅仅是table在工作表中的位置(类似于R1C1),而是您定义的名称,如果您移动 table 将不会受到影响。