PDA

View Full Version : [SOLVED:] Automatic update links from Excel sheet



Nicolaf
10-23-2015, 09:06 AM
Hi,

I have a VBA macro I run from an Excel workbook which opens a specific Powerpoint file called Presentation1.pptx

Code below:


Sub Macro1()
' Opens Presentation1.pptx

Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Visible = True
PPT.Presentations.Open Filename:="P:\lonib\Presentation1.pptx"
End Sub



Presentation1.pptx contains some links from my Excel workbook.
The problem is that when I open file Presentation1.pptx using Excel Macro the links are not updated and I need to update them manually using Update Link function.

Is there a way to amend my code so that when the Powerpoint Presentation1 is opened all the Excel links get updated automatically?

Thanks,
Nic

:think::think:

John Wilson
10-23-2015, 10:49 AM
You would probably need to add code to update if you open with code


Sub Macro1()
' Opens Presentation1.pptx
Dim PPT As PowerPoint.Application
Dim osld As PowerPoint.Slide
Dim oshp As PowerPoint.Shape
Dim ppPres As PowerPoint.Presentation
Set PPT = New PowerPoint.Application
On Error Resume Next
PPT.Visible = True
Set ppPres = PPT.Presentations.Open(Filename:="C:/Users/Optiplex/Desktop/test.pptx")
For Each osld In ppPres.Slides
For Each oshp In osld.Shapes
oshp.LinkFormat.Update
Next
Next
End Sub

Nicolaf
10-24-2015, 10:29 AM
Great Thanks!
Nic
:hi::hi: