Repeating my question that has not been answered until now: Relink Excel Range in PowerPoint

  • Thread starter Thread starter Holger Gerths
  • Start date Start date
H

Holger Gerths

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.
 
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.
 
Back
Top