Thread: [Solved] CommandBars in powerpoint
View Single Post
 
Old 02-24-2014, 05:08 AM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,913
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Easiest way to have a delay is to read the timer and loop until iot reaches a set increment.

I don't know a way to check whether Slide Number etc are already checked. I guesss you could insert a slide and see if the number was visible as a check
Sub example()
Dim wName As String
Dim hWnd
Dim lpClass As String
Dim osld As Slide
CommandBars.ExecuteMso ("HeaderFooterInsert")
delayMe 0.5
wName = "Header and Footer"
lpClass = "#32770"
hWnd = FindWindow(lpClass, wName)
If hWnd <> 0 Then
Set osld = ActivePresentation.Slides.Add(1, ppLayoutTwoColumnText)
If Not osld.HeadersFooters.SlideNumber.Visible Then
SendKeys "%N" 'tick number
SendKeys "%Y" ' Apply to all
osld.Delete
End If
End If
End Sub
Sub delayMe(sngsec As Single)
Dim sngStart As Single
sngStart = Timer
While sngsec + sngStart > Timer
DoEvents
Wend
End Sub


The only way AFAIK to "click" the buttons is to use SendKeys
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote