Start a Powerpoint slideshow from a slide without showing the first slide for a brief moment - vba

I think the title is self - explanatory.
I want to use a VBA macro to start the slideshow from a specific slide, for example the 5th one.
If i use
ActivePresentation.SlideShowSettings.Run.View.GotoSlide 5
it flashes the first slide for a brief moment. I want to get rid of that.
I'm thinking that it might be possible to show the slideshow with a black screen only, change the slide and then show the slideshow correctly, but I don't know how to start it as a black screen.

Try this:
With ActivePresentation.SlideShowSettings
.RangeType = ppShowSlideRange
.StartingSlide = 5
.Run
End With
edit: .RangeType = ppShowSlideRange was missing.

Related

VBA PowerPoint Toggle or Disable Animation During Presentation

In short, the issue I'm running into is that when using VBA to change font size during a presentation, the slide runs all animations for that slide a second time. Changing other qualities, such as font color or shape fill, the slide does not animate a second time.
The longer version: I'm creating a tool in PowerPoint for my trainers to be able to build quizzes and computer-based trainings. I'm using a template shape for each state of the button (correct, incorrect or unanswered), and then have .pickup and .apply to change the formatting of the shapes on the question slides. At runtime, the slide builds based on the animations, the user clicks an option and the shapes format immediately. However, the font size also changes to mirror the template shape. When I temporarily store the font size and reapply it after .apply, at runtime, the slide animates, the user clicks an option and the slide runs the animations again (albeit correctly with the new formatting). The code works, but certain changes cause the slide to animate a second time (text, size), and some changes don't (shape color, text color). It's this second animation of the slide I need to avoid.
Windows 7 Professional;
PowerPoint 2016
Instead of using .pickup & .apply, one thought was to change qualities of everything but the font size, (the fill and line qualities), but for the fill, alone there are 20+ qualities, and that's before getting into number of gradient stops, shadows, etc. I need my developers to have the freedom of formatting the shape as they want that my code can quickly pull from.
.SlideShowSettings.ShowWithAnimation - setting to 'false' at the start of the code and 'true' yielded no change in results. (Attempt shown in code below.)
.SlideShowWindow.View.State - setting to 'paused' and 'running' also did not affect anything. (Attempt shown in code below.)
All objects on the slide are set to fade in automatically upon showing the slide. The simplified code here is set to run when a shape is clicked and shows what works and what doesn't work. I've commented lines in and out so I can try different things.
Sub ProcessResponse()
'These options do not prevent re-animation when in mid-presentation:
'ActivePresentation.SlideShowSettings.ShowWithAnimation = msoFalse
'ActivePresentation.SlideShowWindow.View.State = ppSlideShowPaused
'The following items do NOT cause the slide to run the animation again (desired result):
'Changing the object fill.
'ActivePresentation.Slides(1).Shapes(1).Fill.ForeColor.RGB = RGB(50, 25, 100)
'Changing text color.
'ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Font.Color.RGB = RGB(50, 25, 150)
'The following lines of code cause the slide to run the animation again (undesired result):
'Changing the font size.
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Font.Size = 40
'Changing the text.
'ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "Changed"
'Closing the above attempts.
'ActivePresentation.SlideShowSettings.ShowWithAnimation = msoTrue
'ActivePresentation.SlideShowWindow.View.State = ppSlideShowRunning
End Sub
Setup: Slide with animations (i.e., fade in) that run "after next". 3-4 shapes, each with the above code called when clicked.
During the slide show:
Expected - animations, user clicks shape, the changes are made, no further actions/animations.
Actual Result - animations, user clicks shape, animations (changes are included).
Thank you for any and all help and considerations. Your time is appreciated.

How to assign Textshape 1 as the title?

With Office 2016 PPT, after sharing a PPT file and getting it back, it now has retained titles on the slides but they are now "TextShape 1", are in the correct location (top of slide), and do not show up as titles in the outline view, etc.
Merely resetting the slides overlays empty boxes.
How can I make "TextShape 1" on each of the slides to be seen as the Title for the respective slides? A redefinition? Add a new Title box with the content of "TextShape 1", and delete the old box?
Thanks for the views.
It was not easy as a vba-powerpoint beginner finding my way through the collections and terminology, and certainly time consuming, but I wrote a solution for the limited problem as presented.
You might think you could add a title object, but at least the way I tried, it complained that that could not be done with the current slide layout. I could not figure out how to designate a text box as a Title. So I used vba to set the formats to Titleonly for slides without one, copied the text into it, then deleted the old shape that was overlaid with the new one as below:
Attribute VB_Name = "Module1"
Sub newtitles()
Dim s As Variant
For s = 1 To ActivePresentation.Slides.Count
If Not ActivePresentation.Slides(s).Shapes.HasTitle Then
ActivePresentation.Slides(s).Layout = ppLayoutTitleOnly
' adds a title placeholder too; could not .addtitle to slide without a title in format
ActivePresentation.Slides(s).Shapes.Title.TextFrame.TextRange.Text = ActivePresentation.Slides(s).Shapes(1).TextFrame.TextRange.Text
ActivePresentation.Slides(s).Shapes(1).Delete ' remove redundant box
End If 'about title
Next ' slides
End Sub

How to get the master layout slide name

I'm populating PowerPoint slides with data from an Excel spread sheet. At the moment, I'm accessing the slide using the page number:
Set mySlide = PowerPointApp.ActivePresentation.Slides(1)
Using the Master View option in the UI, you can rename the slide. How can I find the slide using that name?
Thanks,
Carlo.
ActivePresentation.Slides(i).Master.Design.Name
It is the name you see for the theme, in the master view for the slide.
layoutIndex = ActivePresentation.Slides(i).CustomLayout.Index
It is the current layout of the slide in the above theme.
ActivePresentation.Slides(i).Master.Design.Parent.CustomLayouts.Item(layoutIndex).Name
It is the layout name of the currently selected layout of the slide.
it is the VBA, what you can say :-).
Using the Slide.Name property will define the name of the slide and allow it to be called using:
ActivePresentation.Slides("Name")
per the MSDN
So, what I wanted was a way to uniquely identify a PPT slide through VBA. The problem is that I still need to be able to identify that slide if it is copied to another PPT document.
So, what I found I had to do was:
create a text box on each page and hard-code the text to be something like "Slide:Cover" or "Slide:QuarterlyResults", etc.
loop through each slide
find "Slide:" and strip it out to get the page title. That way, if the slide is copied to another PPT document, the name goes with it.
create a Dictionary that uses the Slide.SlideID as the key and the page title as the value.
Then what I do is loop through the slides, get the SlideID, use the Dictionary to get the page title and use a Select statement to map to the proper method to process the slide.
Yeah, I know... it's an icky hack, but it's the only way I could think of doing it.
Thanks for you help,
Carlo.

cell text looking like its being highlighted on long press for moveable table cells

**** updated with screen grab ****
I followed this tutorial on how to incorporate a long press on a table cell to move them around. (tutorial). I got everything working the way I wanted it to, but the first time you selected a cell and move it, all the cell text is set to black, and it should just blend in with the background of the cell, but instead the text is black with a lighter grey colored box around the text. This only happens the first time I selected the cell, after that it just shows a blackened cell. Any idea what may cause this? It almost looks as though the text is selected or highlighted from the long press, but why does it only happen the first time?
I ended up just hiding the text using alpha when selected and turning the alpha back to 1 on release.
on selected
cell.detailTextLabel.alpha = 0;
cell.textLabel.alpha = 0;
on release
cell.detailTextLabel.alpha = 1;
cell.textLabel.alpha = 1;

Microsoft Office 2007 Macro - Odd behavior. Cursor Jumps

I hope someone have some insight into this.
I have a check box on page 1 and when it's clicked, it will launch a macro & insert a value to a text box on page 10. Simple
The problem is, the script in the macro is looking for the value of another text box on page 5 to do some calculation. Whenever i do
text5value = Val(oFFld("Text5").Result)
or
If (Val(oFFld("Text5").Result) = "") Then
The cursor will suddenly move from page 1 to page 5. Very confusing to user.
This behavior happens whenever I try to get the value of a textbox. Wherever that textbox is in the current document, it will jump to it.
Please help
Try setting Screen Updating to false for the duration of the macro.
Application.ScreenUpdating = False
Not only will this hide the various screen jumps it is doing while the macro runs, the macro will also run faster if it doesn't have to constantly update the screen.