PowerPoint VBA macro to skip animation on a slide - vba

I've got some PowerPoint slides containing various pieces of custom animation (e.g. piece of text appears, pause, next piece of text appears, user clicks to show image). However, is it possible to add a macro so that the user could click a button and bypass all the animations to jump directly to the end state of the same slide? I know how to link a macro to a button, it's just the VBA itself that's the problem.
Thanks

Have you tried?
Sub JumpToEndOfAnimations()
Call SlideShowWindows(1).View.GotoClick(msoClickStateAfterAllAnimations)
End Sub

You can add a duplicate of the slide in its end state with no animations, hide it, then add an action button on your animated slide that links to the hidden, unanimated version of the same slide.

Related

Button in PowerPoint that only works in presentation / slideshow

I am creating a presentation and I wish to create a button that works inside the presentation but also outside the presentation/slideshow. I wanted some unique things so I basically used a label as a button instead of a button, because I didn't want a frame around it and I didn't want to spend the extra 10 seconds in changing it around more or less. The button is working fine while within presentations but outside if I click it I only select the label itself.
I tried changing the type of button but it didn't work.
I would like the button to work inside the presentation and outside of it.

VBA: Can't change Image Control picture after click on element

Setup
I have an Excel VBA UserForm with an Image Control element. When clicking on buttons in the form, the Image Control's Picture source is set / updated with the following code:
Set MyForm.imgControl.Picture = LoadPicture(pathToFile)
Problem
When the user clicks on the Image Control, updating its Picture source doesn't work anymore. The problem occurs, no matter when in the workflow the Image Control is clicked:
Example 1: User clicks a button to set the Picture (and pictures sets correctly). User clicks on Image Control. User clicks a different button to change the Picture -> displayed picture doesn't change.
Example 2: User clicks on Image Control right after Form load. User clicks on button to change the Picture -> displayed picture doesn't change.
If the user never clicks on the Image Control, everything works perfectly smoothly. It's worth noting that clicking on the Image Control doesn't visibly focus it.
Question
Clicking on the Image Control shouldn't make a difference in whether or not the Picture can be updated or not. How can this be done? Or, at least, does anyone know why the explained behavior is happening, or is it just a bug?
The Control does have Click / MouseDown / ... events (which are empty), but they don't take a Cancel parameter.
It does sound like a bug, as you say, but as a workaround, I'd suggest forcing a repaint after changing the picture:
Set MyForm.imgControl.Picture = LoadPicture(pathToFile)
MyForm.Repaint

Disable advancing to next slide on click or keypress

In PowerPoint, how do I disable moving to next slide on click or keypress during slide show programmatically?
I have found quite a few results in Google, but all of them simply ask me to uncheck that particular option in the Ribbon. I need a VSTO/VBA way of doing this. My slides contain hyperlinks that will handle navigation between slides. I do not want to have other ways of navigation.
Also the following line didn't do the trick for me:
Pres.SlideShowSettings.AdvanceMode = PpSlideShowAdvanceMode.ppSlideShowManualAdvance;
OMG. Can't believe I found this so quickly. Here's the setting that serves the exact purpose I was looking for:
Pres.SlideShowSettings.ShowType = PpSlideShowType.ppShowTypeKiosk;
This will disable all kinds of keyboard and mouse navigation (including the navigation toolbar that appears at the bottom left during slide show). I am now be able to cruise through the show using my own hyperlinks.

Click a link to another slide in powerpoint without going full screen

I'm creating a powerpoint which has a contents page, I would like that contents page to have clickable links to other slides in the presentation. The problem is currently those links only work when I go full screen, is there a way which I can click the link without going full screen?
Thanks
As Steve says Links only work in show mode. To get them to work in edit the only way is to RIGHT CLICK on them and choose Open Hyperlink from the menu.
Links only work in Slide Show view.
If you go to Slide Show | Set Up Slide Show, you can choose "Browsed by an individual (window)"
Then the slide show window will be moveable/resizable and won't necessarily fill the screen.
If the problem is that your presenter(s) aren't putting the deck into slide show mode before they start presenting (meaning your links don't work in normal/edit mode), you could try one of these solutions:
Add a solid filled rectangle that fully covers your first slide and set any Entrance animation on it with the Trigger / On Click of set to this shape. Then write the text in the shape "Please press F5 to start this presentation". The shape will never be seen in slide show mode but is a polite reminder for your presenters when they open the .pptx file.
Save the deck in the .ppsx file format, forcing it to automatically start in slide show mode.

Simulate Winforms Button Click Animation

I have a button and inside my button I have an image control. When the users click on the image I'd like to animate the button so it appears the button was pressed. I don't really care whether the actual button press event fires or not--it's the illusion of a button press I want to see.
Note: the only options I see on the web involve writing directly to the Windows API--a level of complexity and non-upgradability I really don't want to get into.
Why not just use two different images, one for a normal state, and another for when your button is being pressed.
If you want to go for more complicated route try using GDI+. Here is a quick sample tutorial on how to do this.
Why are you using an image control inside your button control instead of using the button control's Image property?
Using the Image property of the button will give you a button with an image that the user can press and that will raise the OnClick event without doing any extra work or re-implementing features that are already available.
I ended up making my picturbox look like a button by giving it a raised border style. Then on the mouseclick event I simulate the look of a button press by changing the border style for a few hundred miliseconds.
Private Sub simulateButtonPress(ByRef pictureBox As Infragistics.Win.UltraWinEditors.UltraPictureBox)
pictureBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset
Application.DoEvents()
System.Threading.Thread.Sleep(400)
pictureBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Raised
Application.DoEvents()
End Sub