Header
PowerPoint tips, hints and tutorials that will change your presentations for ever!

INDEX

 

Jigsaws
Sounds
Video
Custom Shows
vba code
NaviSlides
Games for teachers
Bullets
Triggers
Security
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Animation
Hyperlinks
Set spellcheck language


Home buttonTutorial buttonContact buttonProducts button


Create vba Link Buttons

Buttons can have action settings to run vba code. This would seem to be a good way to defeat the problem of internal hyperlink storage limits being exceeded in versions before 2007.

Make sure you understand the limitations of vba before you start

What Code To Add to The Button Click

You will probably be tempted to use something like:

Sub Jump()
ActivePresentation.SlideShowWindow.View.GotoSlide 5
End Sub

There are two problems with this:

1. Lots of different code for each "Jump"
2. If you move slide 5 it falls apart

A Better Way?

Add the button to the DESTINATION slide. SELECT THE BUTTON

Now run this code

Sub makeButton()
If ActiveWindow.Selection.Type = ppSelectionShapes Then
With ActiveWindow.Selection.ShapeRange(1)
.AlternativeText _
= CStr(ActiveWindow.Selection.SlideRange(1).SlideID)
With .ActionSettings(ppMouseClick)
.Action = ppActionRunMacro
.Run = "jump2"
End With
End With
End If
End Sub

This adds the destination ID to the button

NOW COPY PASTE THE BUTTON TO ANYWHERE IT IS NEEDED

This is the code that the buttons should run

Sub jump2(oshp As Shape)
Dim Isld As Long
Isld = ActivePresentation.Slides.FindBySlideID(CLng(oshp.AlternativeText)).SlideIndex
ActivePresentation.SlideShowWindow.View.GotoSlide (Isld)
End Sub

This code is used for ALL buttons

 
 

Back to the Index Page

POWERPOINT BLOG

Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation