Discussion:
Repeating my question that has not been answered until now: Relink Excel Range in PowerPoint
(too old to reply)
Holger Gerths
2004-07-14 09:32:11 UTC
Permalink
Hello NG,

I try the following VBA Code to update a linked Excel(2003) Cell Range in
PowerPoint(2003):

Sub Relink()
' Assume that the Excel Workbook is in the same directory as the ppt
ActivePresentation.Slides(1).Shapes(1).LinkFormat.SourceFullName =
ActivePresentation.Path & "MyExcelWorkbook.xls!MySheet!R2C2:R13C6"
ActivePresentation.Slides(1).Shapes(1).LinkFormat.Update
End Sub

The reason to do this is to relink the linked Excel Range when the Excel
Workbook has been moved or renamed and
PowerPoint unfortunately stores OLE links (like any other Office App) with
absolute paths.

Even though I specify the Cell Range (...MySheet!R2C2:R13C6) in the same way
as it was in the LinkFormat.SourceFullName - property,
the link is now, after relinking, the whole Excel Sheet, not the cell range.

Any idea? Thanks in advance.

With best regards,
Holger.
Shyam Pillai
2004-07-14 10:53:25 UTC
Permalink
Holger,
Works for me after I make a subtle change:

ActivePresentation.Slides(1).Shapes(1).LinkFormat.SourceFullName = _
ActivePresentation.Path & "\MyExcelWorkbook.xls!MySheet!R2C2:R13C6"
ActivePresentation.Slides(1).Shapes(1).LinkFormat.Update

ActivePresentation.Path does not append the path separator unless it is a
root folder.
--
Regards
Shyam Pillai

Animation Carbon - http://www.mvps.org/skp/ac/index.html
Post by Holger Gerths
Hello NG,
I try the following VBA Code to update a linked Excel(2003) Cell Range in
Sub Relink()
' Assume that the Excel Workbook is in the same directory as the ppt
ActivePresentation.Slides(1).Shapes(1).LinkFormat.SourceFullName =
ActivePresentation.Path & "MyExcelWorkbook.xls!MySheet!R2C2:R13C6"
ActivePresentation.Slides(1).Shapes(1).LinkFormat.Update
End Sub
The reason to do this is to relink the linked Excel Range when the Excel
Workbook has been moved or renamed and
PowerPoint unfortunately stores OLE links (like any other Office App) with
absolute paths.
Even though I specify the Cell Range (...MySheet!R2C2:R13C6) in the same way
as it was in the LinkFormat.SourceFullName - property,
the link is now, after relinking, the whole Excel Sheet, not the cell range.
Any idea? Thanks in advance.
With best regards,
Holger.
Loading...