Use of PPT.ApplyTheme.BackgroundStyle in MS PowerPoint 2010 to Apply Themes & Backgrounds

In this article I am going to explain about how to use the ApplyTheme method and the BackgroundStyle property in a Microsoft PowerPoint 2010 to apply themes & backgrounds.
  • 4102

Introduction

In this article I am going to explain about how to use the ApplyTheme method and the BackgroundStyle property  in a Microsoft PowerPoint 2010 to apply themes & backgrounds. For this we use PPT.ApplyTheme.BackgroundStyle 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 TestBackgroundStyle()

    Dim vip As Slide
    vip = ActivePresentation.Slides(1)
    Const themePath As String = 
"C:\Program Files\Microsoft Office\Document Themes 14\"
    Const themeName1 As String = themePath & "Angles.thmx"
    Const themeName2 As String = themePath & "Perspective.thmx"
    Const themeName3 As String = themePath & "Waveform.thmx"

    ActivePresentation.ApplyTheme(themeName1)
    CycleThroughStyles(vip)
    ActivePresentation.ApplyTheme(themeName2)
    CycleThroughStyles(vip)
    ActivePresentation.ApplyTheme(themeName3)
    CycleThroughStyles(vip)

End Sub

Private Sub CycleThroughStyles(vip As Slide)

    vip.BackgroundStyle = msoBackgroundStylePreset1
    vip.BackgroundStyle = msoBackgroundStylePreset2
    vip.BackgroundStyle = msoBackgroundStylePreset3
    vip.BackgroundStyle = msoBackgroundStylePreset4
    vip.BackgroundStyle = msoBackgroundStylePreset5
    vip.BackgroundStyle = msoBackgroundStylePreset6
    vip.BackgroundStyle = msoBackgroundStylePreset7
    vip.BackgroundStyle = msoBackgroundStylePreset8
    vip.BackgroundStyle = msoBackgroundStylePreset9
    vip.BackgroundStyle = msoBackgroundStylePreset10
    vip.BackgroundStyle = msoBackgroundStylePreset11
    vip.BackgroundStyle = msoBackgroundStylePreset12

End Sub

Step for creating Application

Step 1 : Start Microsoft PowerPoint 2010 :

1.jpg
 

Step 2 : Using Alt + F11 Key Start Visual Basic for Applications (VBA) Window :

2.jpg
 

Step 3 : Select on VBAProject(Presentation 1) :

3.jpg
 

Step 4 : Right Click On VBAProject(Presentation 1) ==> Goto Insert==> Goto Module & click on Module:

4.jpg

5.jpg
 

Step 5 : Write Code in Visual Basic for Applications (VBA) Window :

Clipboard13.jpg

Clipboard15.jpg
 

Step 6 : Run Application using F8 :
In this application we use F8 to run application step by step. Using of F8 we will find all three themes as output.
 

Step 7 : Macros window will open, Select Macros name and click on Run Button :

Clipboard06.jpg
 

Step 8 : Output of Application :

Clipboard17.jpg

Clipboard18.jpg

Clipboard19.jpg

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.