Excel VBA 1.3

Adding a new Object Library Reference

The procedure describes how to add an Object library reference, and afterwards how to declare new variables with reference to the new library class objects.

The example below shows how to add the PowerPoint library to the existing VB Project. 

As can be seen, currently the PowerPoint Object library is not available.
Step 1: Select Menu Tools –> References…
Step 2: Select the Reference you want to add. This example we scroll down to find “Microsoft PowerPoint 14.0 Object Library”, and then press “OK”.

Note: PowerPoint 14.0 means that Office 2010 version is installed on the PC.

Step 3: in the VB Editor, once you press Ctrl+Space together, you get the autocomplete option of PowerPoint.

After selecting PowerPoint and pressing ., another menu appears with all objects options related to the PowerPoint

Object Library. This example shows how to select the PowerPoint’s object Application.

Step 4: Now the user can declare more variables using the PowerPoint object library.
Declare a variable that is referencing the Presentation object of the PowerPoint object library.
Declare another variable that is referencing the Slide object of the PowerPoint object library.
Now the variables declaration section looks like in the screen-shot above, and the user can start using these variables in their code.

Code version of this tutorial:

Option Explicit
Sub Export_toPPT()
Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
' here write down everything you want to do with the PowerPoint Class and objects

Be the first to comment

Leave a Reply