I would like to create a macro that will loop through all the slides in a PowerPoint presentation and reapply the Notes Master layout to each slide.
I found a VBA macro to do this, but it was written for use on Windows and I use a Mac.
Here is the script:
Sub ApplyMasterToNotes()
Dim ctl As CommandBarControl
Dim oSl As Slide
Set ctl = CommandBars.FindControl(Id:=700)
ActiveWindow.ViewType = ppViewNotesPage
If (ctl Is Nothing) Then
MsgBox "command not available"
Exit Sub
End If
For Each oSl In ActivePresentation.Slides
ActiveWindow.View.GotoSlide (oSl.SlideIndex)
DoEvents
ctl.Execute
DoEvents
'SendKeys "%r{enter}" <---- this is what I am trying to replicate on the Macintosh
'MacScript ("tell application " & Chr(34) & "System Events" & Chr(34) & " to keystroke " & Chr(34) & "%r" & Chr(34) & " to key code 36")
MacScript ("tell application " & Chr(34) & "System Events" & Chr(34) & " to key code 36") 'this will type <RETURN>
DoEvents
Next
End Sub
The invocation of SendKeys is what gets this done on the Windows side, I've learned that this does not exist for the Mac, but that the functionality of SendKeys can be mimicked using MacScript and "to keystroke" and "to key code". The "%r" notation specifies that the Reapply master checkbox on the Notes Layout dialog is to be clicked. Getting that option checked is what I cannot get to work.
I've put together as best I can the MacScript equivalent of the SendKeys in the first MacScript show above. This does not work. It gives an error "Run-time error '5': Invalid procedure call or argument" on the first slide.
The second MacScript runs, it loops through each slide, presents the Notes Layout dialog, automatically 'clicks' the OK button and proceeds to the next slide. The problem is, that the 3rd option in this "Notes Layout" dialog, "Reapply master" has not been clicked so nothing is changed.
I would some help to pass the equivalent of the SendKeys "%r{enter}" using MacScript. Or would be happy to learn of a better way to accomplish my goal of automatically reapplying the Notes Master to every slide.
Thanks, Jack
Aucun commentaire:
Enregistrer un commentaire