1
我想將PowerPoint演示文稿圖形中的鏈接轉移到另一個文件夾。找到一些代碼,但它只選擇特定的文件來改變鏈接,而不是我不能使用的文件夾,因爲我的PowerPoint鏈接到兩個不同的Excel文件(在同一個文件夾中)。更改Powerpoint鏈接到不同的文件夾
Sub M1()
Dim sld As Slide
Dim sh As Shape
Dim strNms As String
Dim intI As Integer
Dim strNewPath
Dim ExcelFile
Dim exl As Object
Set exl = CreateObject("Excel.Application")
'Open a dialog box to promt for the new source file.
ExcelFile = exl.Application.GetOpenFilename(, , "Select Excel File")
For Each sld In ActivePresentation.aSlides
For Each sh In sld.Shapes
If sh.Type = msoLinkedOLEObject Then
With sh.LinkFormat
strNms = .SourceFullName
intI = InStr(1, strNms, "!")
strNewPath = ExcelFile & Mid(strNms, intI, Len(strNms) - intI + 1)
.SourceFullName = strNewPath
End With
End If
Next sh
Next sld
End Sub