0% found this document useful (0 votes)
182 views2 pages

PowerPoint VBA

This document contains VBA code for navigating and controlling a PowerPoint slideshow presentation. It includes subroutines for going to the last viewed slide, next slide, previous slide, first slide, a quiz slide, and getting the current slide index. There are also functions to handle correct and wrong answers as well as exporting the current slide to a PDF file.

Uploaded by

joshua939ebay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
182 views2 pages

PowerPoint VBA

This document contains VBA code for navigating and controlling a PowerPoint slideshow presentation. It includes subroutines for going to the last viewed slide, next slide, previous slide, first slide, a quiz slide, and getting the current slide index. There are also functions to handle correct and wrong answers as well as exporting the current slide to a PDF file.

Uploaded by

joshua939ebay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Public Slide As Integer

Sub GotoLastViewed()
SlideShowWindows(1).View.GotoSlide (SlideShowWindows(1).View.LastSlideViewed
.SlideIndex)
End Sub
Sub GotoNext()
SlideShowWindows(1).View.GotoSlide GetCurrentSlide() + 1
End Sub
Sub GotoPrevious()
SlideShowWindows(1).View.GotoSlide GetCurrentSlide() - 1
End Sub
Sub GotoPage1()
SlideShowWindows(1).View.GotoSlide 1
End Sub
Sub GotoQuiz()
SlideShowWindows(1).View.GotoSlide 3
End Sub
Function GetCurrentSlide()
GetCurrentSlide = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
End Function
Sub correctAnswer()
Call GotoNext
waitTime = 0.5
Start = Timer
While Timer < Start + waitTime
DoEvents
Wend
SlideShowWindows(1).View.GotoSlide GetCurrentSlide() + 2
End Sub
Sub WrongAnswer()
SlideShowWindows(1).View.GotoSlide GetCurrentSlide() + 2
waitTime = 2
Start = Timer
While Timer < Start + waitTime
DoEvents

Wend
Call GotoLastViewed
End Sub
Public Sub ExportAsFixedFormat_CurrentSlide()
'ActivePresentation.ExportAsFixedFormat ActivePresentation.Path & "\Print
s Current Page.pdf", ppFixedFormatTypePDF, ppFixedFormatIntentScreen, msoCTrue,
ppPrintHandoutHorizontalFirst, ppPrintOutputBuildSlides, msoFalse, , ppPrintCurr
ent
MsgBox "complete", vbOKOnly
ActivePresentation.Close
End Sub

You might also like