Introduction
In this article I am going to explain about how to Export Slides in a Microsoft PowerPoint 2010 presentation. For this we use PPTX Files Using PPT.PublishSlides, PublishSlideRange in Microsoft PowerPoint 2010.
Microsoft Office 2010 offer some powerful tools, using this tools you can create application. Using Microsoft Visual Basic for Applications (VBA) you can create your own application according to your need. These application can performer some specific task.
For creating application we can use
- VBA host of Excel 2010
- VBA host of PowerPoint 2010
- VBA host of Word 2010
NOTE : OneNote 2010 is not a VBA host.
Code that we use in this application are given below
Sub PublishSlidesDemo()
' Modify this path to meet your own needs:
Const libraryUrl As String = "C:\Temp\"
' Publish all the slides:
PublishSlideRange(libraryUrl, True)
End Sub
Sub PublishSlideRange(libraryUrl As String, Optional OverWrite As Boolean = True, _
Optional startSlide As Variant, Optional endSlide As Variant)
If IsMissing(startSlide) And IsMissing(endSlide) Then
' Neither endpoint specified. Use ActivePresentation.PublishSlides
ActivePresentation.PublishSlides(libraryUrl, OverWrite)
Else
If IsMissing(startSlide) Then
startSlide = 1
End If
If IsMissing(endSlide) Then
endSlide = ActivePresentation.Slides.Count
End If
' Make sure the values are in a reasonable range:
If startSlide < 1 Then
startSlide = 1
End If
If endSlide > ActivePresentation.Slides.Count Then
endSlide = ActivePresentation.Slides.Count
End If
Dim rng As SlideRange
' Create an array containing a list of all the slides to publish:
ReDim slidesToPublish(1 To (endSlide - startSlide + 1)) As Integer
Dim counter As Integer
counter = 1
Dim i As Integer
For i = startSlide To endSlide
slidesToPublish(counter) = i
counter = counter + 1
Next i
' Given the array of slide numbers, publish the slides:
rng = ActivePresentation.Slides.Range(slidesToPublish)
rng.PublishSlides(libraryUrl, OverWrite)
End If
End Sub
Steps for creating Application
Step 1 : Start Microsoft PowerPoint 2010 :
Step 2 : Using Alt + F11 Key Start Visual Basic for Applications (VBA) Window :
Step 3 : Select on VBAProject(Presentation 1) :
Step 4 : Right Click On VBAProject(Presentation 1) ==> Goto Insert==> Goto Module & click on Module:
Step 5 : Write Code in Visual Basic for Applications (VBA) Window :
Step 6 : Run Application using F5 :
Step 7 : Macros window will open, Select Macros name and click on Run Button :
Step 8: Output of Application :
Main slide :
It divide slide in four slide :