Links updating automatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a PowerPoint 2002 presentation in which I need to limit what the
viewers have to do to view the presentation. The presentation has hundreds of
links that need to be updated. To do so, they need to click on Update Links
when the file is opened and then start the show.

I would love to have the file saved in PPS rather than PPT but, unless
there's a way I do not know of, the links won't update if the file is saved
in PPS.

Is there a way, possibly with an add-in, that I could have the links updated
automatically and then the show started, without the users requesting any of
these tasks?

Your help is much appreciated!

Gaetan
 
Gaetan,

Something like this should work:

Add this macro to your presentation:

Sub Update()
Dim oSl as Slide
Dim oSh as Shape
For Each oSl in ActivePresentation.Slides
For Each oSh in oSl.Shapes
If oSh.Type = msoLinkeOLEObject Then
oSh.LinkFormat.Update
End If
Next
Next

' now go to second slide
SlideShowWindows(1).View.GoToSlide(2)

' tell PPT to ignore any changes we made
' don't offer to save the presentation
ActivePresentation.Saved = True

End Sub

Now add an action button to the first slide in the presentation and have its
action setting set to Run Macro: Update (the macro above)

You could label the button "Start Show".
For that matter, you could make the entire slide a graphic and use it to apply
the action setting so a click anywhere would trigger the macro.
 
Hi Steve,

This doesn't quite answer my question, but this is something I was going to
get to anyhow later on, so that's good. Maybe you can help me settle this
issue and then I'll go back to my real issue afterward (which I'll try to
explain in better words below).

About the code you gave me, it's really something I would like to understand
and have functional, as the presentation in which I would include it is one
that will be used throughout the day and left open. So it would be perfect to
have an update button that the user could use in a slideshow view to update
the links, without having to exit the slideshow to update manually, which I
definatly want to stay away from.

The problem is that it does not seem to update the linked objects, which are
cells from Excel spreadsheets, pasted as links with the Paste Special
function in PowerPoint. All that really happens is that the show switches to
slide 2.

You have any clue why?

Now, my original question was asking if it's possible to have a PowerPoint
presentation update its links automatically without prompting the user to do
so when file is opened and then automatically run the presentation in a
slideshow. That means that the user would open the file, links would get
updated without the user noticing (except from the fact that it takes time as
there are over 200 links in the file) and the slideshow would start without
the user requesting it to.

Thanks a bunch for the help you guys are providing to the discussion group!
 
Alternatively, I could set the links to manual update. This would prevent
PowerPoint to ask the users if they want to update links or not. Then I could
save the file in PPS. That would allow the file to be opened in slideshow
view. I would then provide the user with a button to update all links. That
would be just perfect!

That's where you come into the picture by helping me set the code that will
update the links! : )

Basically what you gave me earlier, but it seems there's a problem with it.

Thanks again!
 
The problem is that it does not seem to update the linked objects, which are
cells from Excel spreadsheets, pasted as links with the Paste Special
function in PowerPoint. All that really happens is that the show switches to
slide 2.

Paste/Linked selections from Excel are exactly what I tested with. After it goes to
slide two, have you gone to other slides to look at the linked info?

Note that it doesn't save the presentation; if you want it to do that, you'd have
to add another line of code.
Now, my original question was asking if it's possible to have a PowerPoint
presentation update its links automatically without prompting the user to do
so when file is opened and then automatically run the presentation in a
slideshow. That means that the user would open the file, links would get
updated without the user noticing (except from the fact that it takes time as
there are over 200 links in the file) and the slideshow would start without
the user requesting it to.

That's exactly what this does; the only difference is that the user has to click a
button or do something to force the code to run. Since PPT won't run code
automatically, we do it by having them click a button to start the show.
 
That's where you come into the picture by helping me set the code that will
update the links! : )

Basically what you gave me earlier, but it seems there's a problem with it.

Find this part of the code:

If oSh.Type = msoLinkeOLEObject Then
oSh.LinkFormat.Update

and add this right after it

Debug.Print "Updated: " & oSh.Name


Test the code again and go back to the vb editor, press Ctrl + G to see the result of
the Debug.Print messages.

What do you see?
 
My test PowerPoint file has 4 slides. Slide 1 contains a shape to which I
have applied the macro. Slide 2 has a linked Excel sheet that contains one
cell with the number 1 in it. Slide 3 and 4 are set up the same way slide 2
is, but with numbers 2 and 3 respectively.

Now, I've changed the Excel files so that numbers show 4, 5 and 6. Saved the
files. Went back to the PowerPoint file, ran the show, and clicked on the
shape on slide 1 to run the macro. All it does is to switch to slide 2,
without updating the links.

I went back to the editor. The immediate window shows "1". That's it.
 
Steve Rindsberg said:
Paste/Linked selections from Excel are exactly what I tested with. After it goes to
slide two, have you gone to other slides to look at the linked info?

I did... linked info has not updated.
Note that it doesn't save the presentation; if you want it to do that, you'd have
to add another line of code.

What would that line be?
That's exactly what this does; the only difference is that the user has to click a
button or do something to force the code to run. Since PPT won't run code
automatically, we do it by having them click a button to start the show.

I've reviewed the update link process I was thinking of, and that is fine
with me.
 
My test PowerPoint file has 4 slides. Slide 1 contains a shape to which I
have applied the macro. Slide 2 has a linked Excel sheet that contains one
cell with the number 1 in it. Slide 3 and 4 are set up the same way slide 2
is, but with numbers 2 and 3 respectively.

Now, I've changed the Excel files so that numbers show 4, 5 and 6. Saved the
files. Went back to the PowerPoint file, ran the show, and clicked on the
shape on slide 1 to run the macro. All it does is to switch to slide 2,
without updating the links.

I went back to the editor. The immediate window shows "1". That's it.

Then apparently the code's not running for some reason.
Unless the presentation's in kiosk mode, it'll switch to slide 2 just because you clicked
on something.

Put a break point on this line:

For Each oSl in ActivePresentation.Slides

Then try running the show again. Does it stop on that line? If not, you either haven't
set the action setting on the button correctly or perhaps your security settings prevent
running the code at all.
 
Then apparently the code's not running for some reason.
Unless the presentation's in kiosk mode, it'll switch to slide 2 just because you clicked
on something.

I have removed the slide transition on click and properly set the macro on
an object when clicking.
Put a break point on this line:

For Each oSl in ActivePresentation.Slides

Then try running the show again. Does it stop on that line? If not, you either haven't
set the action setting on the button correctly or perhaps your security settings prevent
running the code at all.

I've put the break point on that line, and believe it or not, it still
switches to slide 2 without updating any of the Excel objects. My security
settings are at low.

What could be wrong??

Thanks for your time!

Here's the code...

Sub Update()
Dim oSl As Slide
Dim oSh As Shape
For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes
If oSh.Type = msoLinkeOLEObject Then
oSh.LinkFormat.Update
End If
Next
Next

' now go to second slide
SlideShowWindows(1).View.GotoSlide (2)

' tell PPT to ignore any changes we made
' don't offer to save the presentation
ActivePresentation.Saved = True

End Sub
 
Then apparently the code's not running for some reason.
I have removed the slide transition on click and properly set the macro on
an object when clicking.


I've put the break point on that line, and believe it or not, it still
switches to slide 2 without updating any of the Excel objects. My security
settings are at low.

What could be wrong??

I don't know, but you haven't answered my question.
Does the code stop at the break point?
If not, it's not running, so of course nothing will be updated.
 
Then apparently the code's not running for some reason.
I have removed the slide transition on click and properly set the macro on
an object when clicking.


I've put the break point on that line, and believe it or not, it still
switches to slide 2 without updating any of the Excel objects. My security
settings are at low.

I don't know, but you haven't answered my question.
Does the code stop at the break point?
If not, it's not running, so of course nothing will be updated.

I put the break point where you asked. Went back to the presentation... ran
the show and activated the macro by clicking on the shape. It didn't update
and still switched to slide 2. If I run the code from the Visual Basic
Editor, of course, all it does is that it stops at that line.
 
I put the break point where you asked. Went back to the presentation... ran
the show and activated the macro by clicking on the shape. It didn't update
and still switched to slide 2. If I run the code from the Visual Basic
Editor, of course, all it does is that it stops at that line.

In the first case, running from the slide show, if it doesn't stop, then it means that the
code's never running in the first place. Naturally, code that never runs won't do what it's
intended to do.

You'll need to figure out why that might be. Check your security settings and the action
setting on the button, and also make sure that the presentation's in Kiosk mode.

In the second case, you can keep pressing F8 to let the code continue running a line at a time
to verify that it does do what it's supposed to. Or not, if that's the case.
 
Alright... I found the problem by taking a closer look at the code. There was
a typo in your code. Missing a "d" in "linked" in the following line:

If oSh.Type = msoLinkedOLEObject Then

Aw rats. I was between computers; tested the thing on one then typed the code back into
a reply here. Sorry 'bout that. But it's a valuable lesson:

Before running the code, choose Debug, Compile in the IDE. That'll catch most of these
foolishnesses.
It was skipping the whole thing and heading straight to the line where it
links to slide 2.

More likely it wasn't running at all and the click on the button was causing the advance
to slide 2.
 
No problem... It was actually a good thing. It got me to practice coding.
I've just started VBA 2 weeks ago and it was a good challenge figuring that
one out. Now I'm sure you did it on purpose just to get me practicing!

You're a good teacher Steve! : )

An interesting concept, that. It's a good thing when we can learn from our own mistakes, but
when OTHERS can learn from them too ... wow.
 
Back
Top