Updating links from Excel

M

Mr. T

Help! (please)

I have an excel app that, when I click a button, is supposed to copy a
powerpoint template to a new file and then update the linked charts in that
new file. (I used paste-special to insert the links.) The links are set to
be updated manually.

I am using the following macro in powerpoint, which works fine when I run it
from powerpoint:

Sub UpdateTheLinks()

For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
If sh.Type = msoLinkedOLEObject Then
sh.LinkFormat.Update
End If
Next
Next

End Sub


In excel, I have a macro that runs the following code. The problem is that I
get an error stating "sub or function not defined" on the line that says
"ppApp.Run "UpdateTheLinks".

sub picture7_Click ()

Dim ppApp As PowerPoint.Application

FileCopy ActiveWorkbook.Path & "\template.ppt", "abc.ppt"

Set ppApp = New PowerPoint.Application
ppApp.Visible = True

ppApp.Presentations.Open NewFileName, msoFalse

ppApp.Visible = msoCTrue

ppApp.Run "UpdateTheLinks" ' this is where I get the error

ppApp.Quit

MsgBox "Presentation Created"

Exit Sub

picture7_ClickErr:
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Next
End Sub
 
M

Mr. T

I got it. The trick was to update the links in powerpoint from Excel rather
than trying to run a macro in powerpoint. There is no code in powerpoint to
run. The crotch of the code in excel is as follows:

Set ppApp = New PowerPoint.Application

With ppApp
.Visible = True
.Presentations.Open NewFileName, msoFalse
.Visible = msoCTrue
.ActivePresentation.UpdateLinks
.Quit
End With

Set ppApp = Nothing
 
M

Mr. T

OK, I figured it out. I'm not going to post the code unless somebody asks
because I'd have to do quite a bit to clean it up. However, feel free to
ask. I don't read this group too often, so if this is an old post and you
want to see the code, just send me an email, (e-mail address removed). --
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top