JCJG
asked on
Powerpoint 2007: How to change Excel file link in powerpoint
Hi, I have created some charts and tables in Excel and would like to automatically have them linked in a ppt file. So I copied the charts and tables and did paste special and paste link in ppt. However, I am unable to change the link source in ppt to a different Excel file by clicking on the Office button - Prepare - Edit Links to File - Change Source and choose the new Excel file.
For example I have a file named File Jan.xlsm already linked to the ppt. Then I tried to redirect the link to File Feb.xlsm. The error message is "The link file is not unavailable..."
Below are the linked path. I can see the second half was not updated.
Original path - C:\Test\Feb Jan.xlsm!OPEX![File Jan.xlsm]Sheet1 Chart 1
New path - C:\Test\File Feb.xlsm!OPEX![File Jan.xlsm]Sheet1 Chart 1
Can someone help? Thanks.
For example I have a file named File Jan.xlsm already linked to the ppt. Then I tried to redirect the link to File Feb.xlsm. The error message is "The link file is not unavailable..."
Below are the linked path. I can see the second half was not updated.
Original path - C:\Test\Feb Jan.xlsm!OPEX![File Jan.xlsm]Sheet1 Chart 1
New path - C:\Test\File Feb.xlsm!OPEX![File Jan.xlsm]Sheet1 Chart 1
Can someone help? Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@JRWilson - Would this need to be coded differently? It would seem that you should be able to update links for all slides in the presentation, as opposed to one shape at a time, correct?
Dave
Sub switch()
Dim mySlide As Slide
Dim myShape As Shape
On Error Resume Next
Dim oldlink As String
Dim newlink As String
oldlink = "feb" ' just the filename
newlink = "jan"
For Each mySlide In ActivePresentation.Slides
For Each myShape In mySlide.Shapes
With myShape.LinkFormat
.SourceFullName = Replace(.SourceFullName, oldlink, newlink)
.Update
End With
Next myShape
Next mySlide
End Sub
Dave
Hi
Yes there a typo in the Link
How to use vba
Your code is basically correct BUT you really should check that the shape IS a linked object (I guess On Error Resume Next should work though)
Yes there a typo in the Link
How to use vba
Your code is basically correct BUT you really should check that the shape IS a linked object (I guess On Error Resume Next should work though)
Sub switch()
Dim mySlide As Slide
Dim myShape As Shape
On Error Resume Next
Dim oldlink As String
Dim newlink As String
oldlink = "feb" ' just the filename
newlink = "jan"
For Each mySlide In ActivePresentation.Slides
For Each myShape In mySlide.Shapes
If myShape.Type = msoLinkedOLEObject Then
With myShape.LinkFormat
.SourceFullName = Replace(.SourceFullName, oldlink, newlink)
.Update
End With
End If
Next myShape
Next mySlide
End Sub
@JRWilson - can you join this related thread? Please help!
https://www.experts-exchange.com/questions/27674821/Updating-Linked-Excel-Pivot-Table-from-Powerpoint.html?anchorAnswerId=37851183#a37851183
Dave
https://www.experts-exchange.com/questions/27674821/Updating-Linked-Excel-Pivot-Table-from-Powerpoint.html?anchorAnswerId=37851183#a37851183
Dave
Dave