|
本帖最后由 moon2778 于 2020-9-29 17:35 编辑
测试了一下,从2013软件版本之后,Excel、PPT的外部链接选项里面,就不能用shift键多选了。10版本及之前是可以的。
所以考虑用vba解决高版本的问题。如下
批量断开外部链接并停止自动更新的方法:
Sub 断开链接()
Dim sh As Shape
For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
With sh
If .Type = msoChart Or .Type = msoLinkedOLEObject Then
.LinkFormat.AutoUpdate = ppUpdateOptionManual
.LinkFormat.BreakLink
End If
End With
Next
Next
End Sub
批量修改引用的文件路径的方法
Sub 更改链接()
Dim sh As Shape
For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
With sh
If .Type = msoChart Or .Type = msoLinkedOLEObject Then
.LinkFormat.SourceFullName = "C:\Users\moon\Desktop\课后练习Excel版数据.xlsx"
.LinkFormat.AutoUpdate = ppUpdateOptionAutomatic
.LinkFormat.Update
End If
End With
Next
Next
End Sub
将改PPT的所有链接路径设置为PPT文件所在文件夹的同名Excel文件的代码:
Sub 更改链接2()
Dim sh As Shape
Dim exlink As String
Dim thislink As String
Dim nxlink As String
thislink = ActivePresentation.FullName
For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
With sh
If .Type = msoChart Or .Type = msoLinkedOLEObject Then
exlink = .LinkFormat.SourceFullName
nxlink = Left(thislink, InStrRev(thislink, "\") - 1)
.LinkFormat.SourceFullName = nxlink & Mid(exlink, InStrRev(exlink, "\"), 99)
.LinkFormat.AutoUpdate = ppUpdateOptionAutomatic
.LinkFormat.Update
End If
End With
Next
Next
End Sub
|
评分
-
1
查看全部评分
-
|