PDA

View Full Version : Run code when next slide opens



Brightspark9
02-03-2016, 03:19 AM
Hi,

I have code that prints the current page as a PDF file.

Can anyone help and show how to run the code as soon as the slide is displayed without having to click buttons.

Thanks for any help.

Sub exportONE()

Dim PR As PrintRange
Dim lngLast As Long
Dim savePath As String
savePath = ActivePresentation.Path & "\" & "Certificate" & ".pdf"
lngLast = ActivePresentation.Slides.Count
With ActivePresentation.PrintOptions
.Ranges.ClearAll ' always do this
Set PR = .Ranges.Add(Start:=lngLast, End:=lngLast)
End With
ActivePresentation.ExportAsFixedFormat _
Path:=savePath, _
FixedFormatType:=ppFixedFormatTypePDF, _
PrintRange:=PR, _
Intent:=ppFixedFormatIntentScreen, _
FrameSlides:=msoTrue, _
RangeType:=ppPrintSlideRange
With Application


For Each w In .Presentations
w.Save
Next w
.Quit


End With

End Sub

Brightspark9
02-03-2016, 04:59 AM
Hello again. Thanks for looking if you already have but I have found a solution to my problem. All I needed to do was to advance to the next slide by means of an action button and set a message box to activate the code when the slide opened.

Thanks