Merge Two Decks into One in MS PowerPoint 2010 Using PPT.MergeWithBaseline in VB.NET

In this article I am going to explain about how to Merge Two Decks into a single baseline deck in a Microsoft PowerPoint 2010 presentation.
  • 3337

Introduction

In this article I am going to explain about how to Merge Two Decks into a single baseline deck in a Microsoft PowerPoint 2010 presentation. For this we use  PPT.MergeWithBaseline, ActivePresentation.InMergeMode in Microsoft PowerPoint 2010.

To run this code you must have three sample presentation name Vipendra, Vipendra1 and vipendra2. In presentation vipendra, create five slides : My Life, My Style, My Rules, Change with the change and Otherwise change will change you. Now save this presentation as Vipendra1 and delete three slides My Life, Change with the change and Otherwise change will change you. After it change Slide My Rules to My Rules vipendra. Now save it and close it. Now again open presentation Vipendra and save it as name vipendra2 and delete slide Otherwise change will change you. Now run this code in Presentation Vipendra2's VBA.

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 TestMergeWithBaseline()      

    Const withPresentation As String = "C:\Temp\Vipendra1.pptx"
    Const baseLinePresentation As String = "C:\Temp\Vipendra.pptx" 

    If ActivePresentation.InMergeMode Then
         ActivePresentation.EndReview()
    Else
 
        ActivePresentation.MergeWithBaseline(withPresentation, baseLinePresentation)       
 
        If ActivePresentation.InMergeMode Then           
 
            If MsgBox("Accept all changes?", vbOKCancel, "MergeWithBaseline") = vbOK Then
                ActivePresentation.AcceptAll()

            Else
                ActivePresentation.RejectAll()
            End If
        End If
    End If
   
 End Sub

Steps for Creating Application

Step 1 : Start Microsoft PowerPoint 2010 :

1.jpg
 

Step 2 : Create a Presentation Vipendra with five slides : My Life, My Style, My Rules, Change with the change and Otherwise change will change you.

Clipboard0111.jpg
 

Step 3 : Now save this presentation as Vipendra1 and delete three slides My Life, Change with the change and Otherwise change will change you. After it change Slide My Rules to My Rules vipendra.

Clipboard0222.jpg
 

Step 4 : Now again open presentation Vipendra and save it as name vipendra2 and delete slide Otherwise change will change you.

Clipboard0333.jpg

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

2.jpg
 

Step 6 : Select on VBAProject(Presentation 1) : 

3.jpg

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

4.jpg

5.jpg

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

Clipboard041.jpg

Step 9 : Run Application using F8 :

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

Clipboard09.jpg

Step 11 : Output of Application : When we try to run this code it create some changes in presentation but before implement changes in presentation it ask to implement changes in presentation. 

Clipboard01.jpg
 

 

Step 12: Now It shows some changes in presentation as show option in slide1 and slide 4 for delete it. We delete slide 1 using this option and it also show some more option in last slide and in right side.

Clipboard02.jpg
 

Clipboard05.jpg
 

Step 13 : Now when we again press F8 in VBA it merge presentation Vipendra in presentation Vipendra2

Clipboard06.jpg
 

Step 14 : Now when we again press F8 in VBA it merge presentation Vipendra1 in presentation Vipendra2

Clipboard07.jpg

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.