Microsoft PowerPoint

PowerPoint is a slide show presentation program currently developed by Microsoft. PowerPoint presentations consist of a number of individual pages or "slides" that may contain text, graphics, sound, movies, and other objects, which may be arranged freely. The presentation can be printed, displayed live on a computer, or navigated through at the command of the presenter. Slides can also form the basis of webcasts.

Share tech news, updates, or what's on your mind.

Sign up to Post

Avoiding 3 Common PowerPoint Misuses
A lot of things can happen during a presentation, worst of which is “death by PowerPoint.” Here are a few mistakes to avoid to make your slides clean.
1
Angular Fundamentals
LVL 13
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

PowerPoint Bubble Text
PowerPoint is the go-to presentation software for millions of users around the world. Many presentations use basic text features but you can really make special text jump out of your slide by applying this bubble text design process. This article has lots of tips and tricks to aid your creativity.
0
PowerPoint Still Works
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
0

Expert Comment

by:Taylor Swift
I'd like to start a blog so I will be able to share my experience and feelings online. Please let me know if you have any kind of ideas or tips for new aspiring blog owners. Appreciate it!
0
Measuring Skill Over Technology
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for designers and businesses alike.
0
Example PowerPoint Add-In
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
5
LVL 19

Expert Comment

by:Kyle Santos
Great job!
0
LVL 16

Author Comment

by:Jamie Garroch
Thanks Kyle Santos :-)
0

Preface:

When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and removed the user interface for creating commandbars. This resulted in a common misconception that all CommandBars have been deprecated (eliminated). The truth is that you can no longer create CommandBar MENUS starting with Office 2007. However, you can still create and use pop-up menus, which are sometimes referred to as "right-click" or "shortcut" menus, using VBA. This series is all about these types of menus; I will use these two terms interchangeably in the remainder of this article.
 

Introduction:

Part 1 of this series (Understanding and Using Commandbars) describes techniques for exploring and using the CommandBar object. Part 2 of the series (Creating your Own) provides a more detailed discussion of the CommandBar and CommandBar Control object models, and demonstrates how to create your own shortcut menus.

While working on a new application, I found a need to not only develop my own right-click menus, but to augment and replace several of the …
4
LVL 55

Author Comment

by:Dale Fye
Thanks.  This is the first article I've written using the new editor, and I like the flexibility.  I was a little disappointed in the ability to size text other than using the couple of "styles".
0
LVL 68

Expert Comment

by:Jim Horn
Excellent article.  Voted Yes.
0

Setting the Scene


Animations in PowerPoint are a great tool to convey messages when used carefuly with the content of your slides.

There are plenty of animation effects and options, including a Repeat feature for individual animation effects.

But what if you want to repeat (or loop) a sequence of animations? This can be useful when running unattended kiosk presentations and you want the animations of the slide or a subset of them to repeat automatically.

You may think that this isn't possible, but it is, and strangely, by utilising the bookmark feature of audio.

In this tutorial, we're going to show you how to continuously repeat the animation sequence below which has three shapes fading in after one another and then after a delay of 1 second, fades out:

PowerPoint-looping-animation-sequence-1.

Building a Looping Slide


1. The first thing to do is to create a silent audio file. You can do this using Windows recorder or any number of third party sound apps. Simply disconnect or mute your mic before recording the required sound length. In this example, we recorded 10 seconds of silence. You can also download the one we used in this tutorial.

Sound-Recorder.pngSilent-10-seconds--MP3-.txt (change the extension to .mp3 as EE don't support MP3 uploads)

2. Next, insert your silent sound file into PowerPoint on the slide that you're animating and set it to Loop until Stopped and Hide During Show:

PowerPoint-looping-animation-sequence-2.3. Now add Bookmarks
5

Expert Comment

by:Ruffy Ruffington
This is a seriously genius workaround.  Thanks for the really useful tip!
0

Expert Comment

by:Charles Simon
Thanks for this excellent idea.  When I implemented it, I realized that I only needed one bookmark and could control the speed of the looping with the trim function on the audio element.
1

Introduction


In all recent versions of PowerPoint it is possible to trigger animations. This means the animation takes place when a certain shape is clicked. This allows you to run animation “on demand” and outwith the normal sequence of mouse clicks.

There is no obvious way to run an animation when a shape is just “moused over” rather than clicked. This is a common feature in web pages but not available in PowerPoint. A typical use might be to show a map or definition when an item is “moused over” and remove it again later.

 

Trigger Animations


Let’s start by creating a triggered animation.  
MO1.jpgLook at the screen shot. If the text has a fade animation and a fade exit in PowerPoint it will currently appear on the first click and fade away on the second. The desired behaviour is it will fade in on the first click ON THE TRIGGER SHAPE and out again on a second click of the shape.

To achieve this open the animation pane. Select both the fade in AND fade out entries (hold down CTRL) and set a trigger of the rectangle from the ribbon as shown. If you have an earlier version of PowerPoint you can use the drop arrow (circled) to choose TIMING and set the trigger here.
MO2.jpg 
mOTrigger.jpgWhen you run the slide show ("DEMO1.pptx") you should find that the text fades in when the button is pressed and out again on a second press.
 
So far, so good but how to make this happen on mouseover?
 

A Trick

3
LVL 24

Author Comment

by:John Wilson
The macro is really just pressing the trigger button. You would need to modify the ANIMATIONS to get what you need. Not that simple but certainly possible,

Simple demo here
0

Expert Comment

by:rajivkohli
Dear Mr. Wilson,

I have a request for you. I wanted to create a replica of Gratitude Logo Designed By Vic Bell @ codepen.io (Link for your reference: https://codepen.io/poziomq/pen/YGRdKG). The above script works fine but there is something that I need to accomplish the above said animation.

As you know that to create this animation, Body and Head will be 2 different objects and both of the objects can move simultaneously using Down Motion Path. So, I need to trigger the Head on Mouse Hover by applying another Motion Path. I named it "Face" and changed the object name in the script as well. The script works fine then but first it Sends the Face behind the Body object (maybe because of msoSendToBack) but if try to change the script to msoBringToFront, it doesn't work. May I know that what I can change in the script so that the Face object remain on top of all other objects?

Secondly, the Body which was following the Down Motion path during Slideshow and when I hover the mouse over the Face for the first time then Body reset it's position and start moving from the beginning along with the Face but then it works fine on the second mouse hover. The Face was also following the Down Motion path and if you hover your mouse over it then it also reset it previous motion path and start moving from the top. Is this could also be possible that the second Down Motion Path applied to Face should only trigger until the Mouse is over the face and stop repeating the second Down Motion path of the face, when you move your mouse away from that object.

Is there something that can be done to correct all those problems? Don't know anything about Visual Basic and sorry for asking too many questions. I hope you will not mind that.

Attaching the presentation for your reference.

Regards
Rajiv Kohli
Gratitude-Logo.pptm
0

Setting the Scene

PowerPoint is a creative tool in the right hands but it also includes a much underutilised programming dimension. In this beginner level article, we're going to show you some of some key elements of programming PowerPoint using the VBA (Visual Basic for Applications) editor that's included with Microsoft Office.

We're going to build a small project that is fairly arbitrary in order to demonstrate several key elements of VBA programming. The project will add a user-defined number of random shapes to a given slide.

What is Covered?

We're going to look at the following elements when building a simple macro to add a sequence of randomly sized, randomly positioned and randomly coloured shapes:


  1. The two types of procedures Sub and Function
  2. Constants, Variables and Arrays
  3. Selected PowerPoint object model properties
  4. User input
  5. Random numbers
  6. Shape creation
  7. Shape formatting

When you've completed the project, you will be able to create the arbitrary random slide like the one shown below in less than a second!

Random-PowerPoint-Shapes.png

Prerequisites

You will need any version of PowerPoint (including Mac) that uses the latest graphics engine and theme design model. This includes 2013 (which we will use), 2010, 2007 and 2011 for the Mac. Your version of PowerPoint must also have the VBA environment enabled (it is installed by default but your IT administrator may have disabled it).

Getting Started

The first thing to do is to recognise that you will be working in two windows, the PowerPoint slide view that you will be familiar with as a PowerPoint content author and the VBE (Visual Basic Editor). You can either Alt+Tab between the two windows, set them up on a different displays if you have a multi-monitor setup or use the Windows snap feature to show them side-by-side on your desktop.

Opening the VBE

To start the VBE:


  1. Open PowerPoint and create a new blank presentation
  2. Press Alt+F11 to open the VBE window:
    VBE---new-project.png
  3. Pretty boring right? Well, that's because there is no content VBA project yet so the first thing to do is to add a code module to the VBA Project. From the VBE menu, click Insert followed by Module:
    VBE---new-module.png
  4. Now we have a code module, we can start adding code. Code is separated into Procedures and each one has a start and and an end as shown in the procedure of type Sub: (the name "mySub" is arbitrary and you can choose whatever you want)
    VBE---Sub-start-and-end.png
  5. Once a procedure is defined, you "just" have to write the code lines within it and we'll start with a really basic single line macro:
    VBE---Hello-World.png
  6. This is now a complete macro and we can run it by pressing the green Run arrow in the toolbar or pressing F5 when the cursor is somewhere within the procedure. Note that we can also run it from the main PowerPoint window by pressing Alt+F8 and selecting the macro myFirstCode but this only works if the procedure is (a) of type Sub (b) not declared as Private (c) does not have any paramaters in the parenthesis. When run, this macro simply displays a message for the user:
    Hello-World-msgbox.png

Getting Stuck In

Now that you know how to create a VBA project, let's step back and think about what we need our program to do:


  1. We want to define a subset of shapes from the large library that PowerPoint supports
  2. We need to ask the user how many shapes to add
  3. We need to get the current slide and add a shape of a random size in a random position and then fill it with a random colour from the presentation theme
  4. We need to repeat #3 the number of times requested by the user input in #2

It is good practice to start every code module with the line Option Explicit. What this does is to force the VBA compiler to check that variables have been declared. While this isn't strictly necessary, it will save a lot of debugging issues as your projects get larger and you make the inevitable typos with variables in your code.

Option Explicit

Next, we are going to define a couple of constants to set the minimum and maximum size of the random shapes, which are available globally to any procedure in the project. These are defined outside of procedures:


Public Const ShapeMinSize = 50
                                        Public Const ShapeMaxSize = 200

Now, VBA provides a nice random number generator function called Rnd which generates numbers between 0 and 1 (but not 1 itself). We want to be able to generate integer numbers between different lower and upper limits so instead of repeating the same code multiple times, we're goign to create a function procedure. A function can optionally accept one or more input parameters and optionally returns a single value, string or object.

This is our function to create a random number within provided limits:

Function GetRandomInt(Lower As Integer, Upper As Integer) As Integer
                                          Dim number As Single
                                          
                                          ' Initialize the random-number generator with a seed based on the system timer
                                          Randomize
                                          
                                          Do
                                            ' Get a random number between 0 and < 1
                                            number = Rnd()
                                            ' Scale it up to the upper limit
                                            number = number * Upper
                                          Loop While number < Lower ' Repeat until the number is above the lower limit
                                          
                                          ' Set the value returned by the function
                                          GetRandomInt = number
                                        End Function

It's worth pointing out at this stage that it's also good practice to add comments to your code and these are made in VBA by prefixing your comment with a apostrophe.

The function accepts two integer parameters for the Lower and Upper limits and returns a value as an Integer.

The next step is to create our main macro procedure of type Sub:

Sub AddRandomShapes()
                                        
                                        End Sub

Checking back on our list of things to do, we need to define the shapes we want to use. Shape types in PowerPoint are defined using an enumeration. Enumerations allow human readable names to be associated with integer values. For example, we could create a custom enumaeration for fruit:


Public Enum Fruit
                                          Apple
                                          Orange
                                          Pear
                                        End Enum

This would assign value of 0 to 2 for the three fruit types which we could then refer to in code by the fruit names. In the same way, Microsoft has defined enumerations for many aspects of the PowerPoint object model. There are over 150 different pre-defined shapes such as rectangle, oval, stars etc. and they are defined by the enumeration msoAutoShapeType. You can check the values in the VBE for enumerations by opening the Object Model with F2 and searching for enumerations, properties, methods and more. We have decide to use the various star shapes in our macro and because the values are not contiguous, we put them in an array so that we can refer to them with our random number generator:


Sub AddRandomShapes()
                                          Dim ShapeIDArray(1 To 10) As Integer
                                        
                                          ' Shape types are defined with the enumeration msoAutoShapeType
                                          ' Stars (points) : 149 (10), 150 (12), 94 (16), 95 (24), 96 (32), 91 (4), 92 (5), 147 (6), 148 (7), 93 (8)
                                          
                                          ' Load with star shapes
                                          ShapeIDArray(1) = msoShape10pointStar
                                          ShapeIDArray(2) = msoShape12pointStar
                                          ShapeIDArray(3) = msoShape16pointStar
                                          ShapeIDArray(4) = msoShape24pointStar
                                          ShapeIDArray(5) = msoShape32pointStar
                                          ShapeIDArray(6) = msoShape4pointStar
                                          ShapeIDArray(7) = msoShape5pointStar
                                          ShapeIDArray(8) = msoShape6pointStar
                                          ShapeIDArray(9) = msoShape7pointStar
                                          ShapeIDArray(10) = msoShape8pointStar

So, calling ShapeIDArrary(3) will return the enumerated value for a 16 point star.

We now need to declare variables for the shape position and size:

  Dim shpTop As Single, shpLeft As Single, shpWidth As Single, shpHeight As Single

And because the user could be using a 16:9 slide, a 4:3 slide or any other slide size, we need to declare variables for the slide height and width:


  Dim sldWidth As Single, sldHeight As Single

Finally, we need variables for a loop counter, the number of shapes the user wants to add and an object declaration for the shape that we will add in each occurence of our loop:


  Dim counter As Integer
                                          Dim NumShapes As Integer
                                          Dim oShp As Shape

When the macro starts, we need to find out the slide dimensions and we use the SlideWidth and SlideHeight properties in the cascading object model. These properties belong to PageSetup which in turn belongs to the ActivePresentation (the presentation currently in view). The VBA object model is hierarchical and each level is separated with a dot, so these are the two lines we need to get the dimensions saved into our variables:


  sldWidth = ActivePresentation.PageSetup.SlideWidth
                                          sldHeight = ActivePresentation.PageSetup.SlideHeight

You'll notice that when you type a dot at the end of a valid property, if it has any children, the Microsoft system called IntelliSense will show you permitted child properties and methods. This makes self-discovery of the object model much easier.

Next we need to get the number of shapes to be added by the user and we use the InputBox function for this:


  NumShapes = Val(InputBox("How many random shapes to you want to add to this slide?", _
                                            "Macro by youpresent.biz", 100))

Note that we've split this line in two to make it easier to read. You can do this with any line of code by adding a space plus an underscore at the point where you want to break the line and then press return.

Now we need to set up the main loop in which the shapes will be added to the slide:

  For counter = 1 To NumShapes
                                        
                                          Next

Within this loop, we need to calculate the shape size and position and we call our random number generator function GetRandomInt to do this:


    shpWidth = GetRandomInt(ShapeMinSize, ShapeMaxSize)
                                            shpHeight = shpWidth
                                            shpLeft = GetRandomInt(-shpWidth, CInt(sldWidth))
                                            shpTop = GetRandomInt(-shpWidth, CInt(sldHeight))

We're now going to use the very useful With statement. What this does is allow us to shorten our code by eliminating the need to repeat long object model statements. We want to do something the the collection of shapes in the current slide in view so this line sets that up for us:


    With ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex).Shapes

And the thing we want to do is add a shape. We could just add the shape and forget about it but because we want to adjust the formatting of the shape after it's been added to the slide, we need to Set a reference to the new shape object:


      Set oShp = .AddShape(ShapeIDArray(GetRandomInt(1, 10)), _
                                                shpLeft, shpTop, shpWidth, shpHeight)

We're going to set a random fill colour from the 6 accent colours of the presentation theme, set a transparnecy of 70%, turn on the outline and make it white:


      With oShp
                                                .Fill.ForeColor.ObjectThemeColor = GetRandomInt(5, 10)
                                                .Fill.Transparency = 0.7
                                                .Line.Visible = msoTrue
                                                .Line.ForeColor.RGB = RGB(255, 255, 255)
                                              End With


Putting It All Together

Adding the closing lines to loops, we end up with our completed code:


1
 

Regular Expressions


Microsoft Word has sophisticated search tools that can search for patterns. For example if you wanted to search for all UK phone numbers that followed a pattern of five digits, a space and then six digits you can easily do this in Word using Advanced Wild Card searches.

The search would look like this:

regX1.jpgThe find what box search pattern is any digit 0-9 five times, followed by a space and then any digit 0-9 six times. "Under the hood" Word is utilizing Regular Expressions to search for a pattern.

Unfortunately PowerPoint has very basic search tools and a search for a pattern is not available from the UI.
 

Search With Code


Look at this code:
Sub use_regex()
Dim regX As Object
Dim oMatch As Object
Dim osld As Slide
Dim oshp As Shape
Dim strInput As String
Dim b_found As Boolean
Dim strReport As String
Dim i As Integer
Dim iFileNum As Integer
Dim b_First As Boolean
Dim b_start As Boolean
Dim strpattern As String

On Error Resume Next
Set regX = CreateObject("vbscript.regexp")
strpattern = "[0-9]{5} [0-9]{6}"
With regX
    .Global = True
    .Pattern = strpattern
End With

For Each osld In ActivePresentation.Slides
    For Each oshp In osld.Shapes
        If oshp.HasTextFrame Then
            If oshp.TextFrame.HasText Then

                strInput = oshp.TextFrame.TextRange.Text
                b_found = regX.Test(strInput)
                If b_found = True Then
                    If Not b_start 

Open in new window

2
LVL 49

Expert Comment

by:aikimark
You need to format your code.  Without indentations, it is difficult to read.  I certainly wouldn't want to add it/use it in any VBA project in its current state.
0
Fundamentals of JavaScript
LVL 13
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Outline


From PowerPoint 2010 it is possible to have shapes appear in front of video, in earlier versions video always played in front of other shapes. This means it is possible to have captions animated to appear in front of video.

Users who have prepared presentations in earlier version will often attempt to add a delay to the caption animations so that they appear and disappear at the appropriate times. However there is a problem because the maximum delay allowed in 2010 and 2013 is 60 seconds which may not be enough for a longer video. Fortunately PowerPoint 2010 and 2013 added a much better way to time animations. In these versions animation can be triggered from bookmarks in the video itself.
 

Adding Bookmarks


After adding your video you can drag the Timeline to the exact spot you would like the first animation to take place.

BM1.jpgOnce you have the exact spot go to Video tools > Playback and click "Add Bookmark".

BM2.jpgThe new bookmark will show as a yellow spot in the video timeline. If you carefully hover the mouse over the spot you will see the name which will be "Bookmark1".

Repeat this process to add any other bookmarks you need.
 

Add The Caption and Animate


Add a textbox or shape and type in the caption. Apply an animation (maybe Fade In). Now open the Animation Pane from the Animation tab and double click on the entry for the added animation.

Click on the "TIMING" Tab and set the box "Start effect on play of:" to the Bookmark required.

BM3.jpg
0

Background

 

Certain code in VBA requires initialization, such as application events. The app initialization is often triggered by the Auto_Open sub which is a special procedure that runs when an add-in loads. More significantly, this sub does not trigger if the VBA is loaded inside a PowerPoint file such as a .pptm file. So how does one get round this?

In this article we'll show you how to create a PowerPoint file, which could be a macro-enabled presentation (.pptm), slideshow (.ppsm) or template (.potm), which contains the necessary VBA code to initialise events based on the ribbon load event in the self-contained XML part of the file.
 

Purpose

 

This sample demo initialises application events when the PowerPoint file opens, without:

  • Installing an add-in (that initiates code with Auto_Open)
  • User interaction (to initialise the app events)


How to Create the PowerPoint VBA/XML/PPTM Project

 



  • Open a new presentation, press Alt+F11 and Insert a class module, naming it clsAppEvents and insert the following code:

Public WithEvents App As Application

Open in new window


  • Click the (General) drop down and select App. You can then click the right hand drop down to select the event procedure you need for your code, for example:

Private Sub App_WindowSelectionChange(ByVal Sel As Selection)
  MsgBox "Selection Changed", vbInformation + vbOKOnly, "App Event Class"
End Sub

Open in new window




  • Insert a standard module and insert the following code:

Public oEH As New clsAppEvents
Public Sub onRibbonLoadAppEvents()
  Set oEH.App = Application
End Sub

Open in new window


  • Save the presentation as a PPTM file and then close PowerPoint.
  • Download and install the Custom UI Editor for Microsoft Office and after running it:
  • Open your PPTM file in the UI Editor
  • Click Insert /
2
LVL 16

Author Comment

by:Jamie Garroch
Understood Antonio. How about this as an idea. You could save it as a pptm and add this to the initialisation procedure to automatically run it in slide show mode as it opens:

ActivePresentation.SlideShowSettings.Run

Open in new window


So it becomes this:

Public Sub onRibbonLoadAppEvents()
  Set oEH.App = Application
  ActivePresentation.SlideShowSettings.Run
End Sub

Open in new window

1

Expert Comment

by:Antonio King
Thanks, that works perfect!
0
PowerPoint---VBA---Productivity.pngMost folk recognise that Microsoft Excel, being a numbers-and-formulae-centric application attracts programmers due to the natural fit in mindset.

Conversly, when opening Microsoft's dominant presentation creative application, few consider what programming could bring to PowerPoint and even fewer have the skill to combine the freedom offered by visual creativity with the accuracy required of programming.

PowerPoint, like all of Microsoft's Office applications comes complete with VBA (Visual Basic for Applications) out-of-the-box. It’s just as relevant here as it is an other Office apps and can bring incredible productivity bonuses for those people and organisations wanting to add automation to the presentation creation and management process.
Like Excel, PowerPoint has it’s own object model and the most basic place to start is in response to the question “I want to do ‘something’ to all shapes on all slides within a presentation.

A presentation comprises a Collection of Slides. In turn, each slide comprises a Collection of Shapes. So looping through all slides and all shapes within each slide is very easy as demonstrated with this code snippet:
 





Option Explicit

Public Sub CheckShapesOnSlides()
  Dim oSld as Slide
  Dim oShp as Shape
    For Each oSld in ActivePresentation.Slides
      For Each oShp in oSld.Shapes
        ‘ Do my checks on the shape here
      Next
  Next
End Sub

Open in new window





With this starting point, one can conceive many useful procedures (a macro is simply a procedure of type Sub, as opposed to a Function
1

Expert Comment

by:dougfosterNYC
Hi Jamie.

I am a VBA programmer in Excel and Access.  I did a very large project automating PowerPoint using VBA, and found it a nightmare project.

Unlike Excel, the PP object model is very limited. In Excel, you can automate anything since the object model is so robust with workbooks, worksheets, and most importantly, ranges.

in PP, trying to find the objects on the slide took great creativity.  they couldn't be managed like ranges are in Excel.  

So if you want to change data in graphs and lists in PP, best of luck to you....

Here is a post on my website about the project.  I didn't put in the challenges of the project: http://www.fostersolutions.com/case-study-phoenix-marketing/
0
Have you ever been sent a PowerPoint presentation file and wondered why it filled your mailbox? Or have you ever sent a PowerPoint presentation by email and received complaints about the size? Or have you ever created a PowerPoint presentation and thought twice about sending it by email because it is so large? If so this article is for you and it can be quite simple to find the answers.

There's no easy way within any version of PowerPoint to find why a presentation is so large. There are numerous articles on the web with good ideas about how to decrease the file size but they may not help much unless you're focusing on the biggest items.

The secret to finding out which are the biggest items in a PowerPoint is to know the format of a PowerPoint pptx file. This type is used by default by Office 2007 and later but can be saved by Office 2000, Office XP, or Office 2003 when a compatibility pack is installed. A pptx file and docx and xlsx and the other Office 2007 types are zip files.

An Office Open XML file is a ZIP-compatible OPC package containing XML documents and other resources. That is, one can see the contents of an OOXML file, for example by renaming it to a .zip file and opening it with any zip tool. The actual .xml files can then be viewed in a web browser or a plain text editor.

So, the easy way to look at a PowerPoint …
2
LVL 14

Author Comment

by:sjm_ee
Many thanks all!
0
LVL 18

Expert Comment

by:Ravi Agrawal
Nice piece of information.

Ravi.
0
This article shows how to simulate drawing numbers or names from a hat or bag using vba in PowerPoint and prevents duplicate items being selected.

It’s not difficult to choose a (semi) random number in vba. The RND function returns a decimal number between zero and 1 (but never 1) so we can easily use it to produce any range. This produces a number between 1 and 10 for example.

Dim myNumber as Long
Randomize
myNumber=INT(RND  * 10)+1 

Open in new window


A more general formula to produce a range of numbers not starting with one would be:

myNumber = INT(RND * the number of items) + lowest number

Open in new window


so to produce a a number in the range 3 to 10 (8 numbers starting with 3)
myNumber=INT(RND * 8)+3

Open in new window


Note that RND is not truly random and the use of randomize resets the seed to increase its variability.

Real Life Scenario:
Consider now drawing a name or number from a hat. Once drawn that number is discarded and cannot be drawn again. You can continue drawing numbers or names confident that you won’t see any duplicates.  This doesn’t happen with RND so there is a chance a name or number can be drawn more than once. This is obviously not desirable!
Perhaps the obvious answer is to check each choice to make sure it has not been used and then to redraw until a unique name or number is selected.  This will work but if most of the numbers or names have already been selected there may be a large number of ‘used’ items selected.

Using a Collection …
0
Periodically someone asks me whether there’s a way to automatically convert all of the pages in a Visio drawing to PowerPoint slides. There have even been a few times when I’ve wanted to do that myself but I never really had enough incentive to figure out the PowerPoint side of it.

One of the reasons I hadn't bothered to solve this problem is built into Visio: if your goal is merely to present Visio drawing pages to an audience, creating PowerPoint slides may be overkill. To present Visio pages, you can just use Visio’s full screen mode by pressing F5 and then navigating from page to page using the arrow keys or PageUp and PageDown.

A recent question here on EE revived my interest in a PowerPoint solution, however, and in one of those wonderful coincidences that sometimes happen, I stumbled across part of the answer while looking for something else!

I was rummaging in the Visio 2007 Software Development Kit (SDK) looking for a way to automate the creation of the very sophisticated time lines Visio can produce (more about that another time…). I did find a potential solution for that problem, but more relevant here, I also found a long-forgotten code sample to create one PowerPoint slide from one Visio page.

Between the PowerPoint code in the sample and the PowerPoint macro recorder -- don’t ever forget about this incredibly useful tool when you’re trying to write code for any Microsoft Office application -- I developed a working solution that saves …
5

Introduction

I recently received a question about the creation of Computer-Based Training (CBT) that incorporates quizzes in the middle of the lesson. The intent was to keep people engaged in the content, and not to actually track students’ scores. After considering several different software packages, I circled back to one of my guiding principles: How can we achieve this simply and easily with the tools we already have at our disposal?

It turns out that MS PowerPoint proves to be a powerful tool in the creation and delivery of simple self-directed learning. This article provides a step-by-step guide to creating a computer-based training presentation that incorporates quizzes.

Advantages of using PowerPoint over dedicated CBT creation software

Most courseware authoring software creates materials in one of two formats: self-running executables or interactive Flash/video files. These formats have limitations in many lock-down corporate environments. Executables are not able to run without prior configuration, testing and deployment. Depending on how they are created, I have noted that the Flash files created by courseware authoring tools can become relatively large, with the potential to impact the computer network and storage infrastructure. Flash content that contains streaming video must also be hosted on a media server for distribution.

PowerPoint files are relatively small if the number of images and embedded media are kept to a minimum, …
9
LVL 7

Author Comment

by:pdoelle
Hey, that's great! Thank you.
0

Expert Comment

by:Volz
Very good.  I'll incorporate this method into a training presentation.
0
People often ask "How do I make this macro run every time I show a new slide or add a new slide etc." This means making PowerPoint respond to that EVENT and, unlike in Excel, it's not that easy!

First, I would avoid using the pseudo events left over from version 97, e.g., Sub OnSlideShowpageChange. Pseudo events are not properly supported in later versions of PowerPoint and so will work erratically.

Also, naming your sub Auto_Open will not work in a standard presentation but will in a PPA (version 97-2003) or a PPAM (version 2007/2010) AddIn.

So, let's create a simple AddIn...

1. Add a Class


A. In the VB editor INSERT >> CLASS MODULE

B. If the properties window isn't already visible, press F4 or View > Properties window to show it. Use this to rename the class module to something more memorable. We used cNewSlideClass.

C. Add the code:
Public WithEvents PPTEvent As Application

Open in new window


2. Create an Object Based on the Class


A. Insert a standard module (INSERT >> MODULE) and declare the object

B. (change the names as appropriate)
Public objNewSlide as New cNewSlideClass

Open in new window


3. Initialise the Object


A. In the normal module create a new sub call Auto_Open. Remember this will only fire in an AddIn and only when the AddIn loads.

B. Add the code as below:
Sub Auto_Open()
    objNewSlide.PPTEVENT = Application
End Sub

Open in new window


4. The Event


A. Back in the class module you will see two drop down menus at the top of the page.
Change the left one to PPTEVENT; the right, select the event to fire your macro. In our case PresentationNewSlide.

B. Between the lines of code auto inserted add the code you want to run.
Here is ours:

Open in new window

3
LVL 16

Expert Comment

by:Jamie Garroch
This is a great article JSRWilson. I'd just like to add that if a developer is looking for a cross-platform compatible solution for application events that will work on PC and Mac versions of PowerPoint, there doesn't appear to be one. Why?

Application Events are supported by PC versions of PowerPoint only (as of PowerPoint:mac 2011, and possible PowerPoint:mac 2016)
Psuedo Events are supported by PC and Mac versions but they are unreliable and in many cases will cause PowerPoint to crash

Finally, to get around the Auto_Open limitation of only firing within an add-in (as opposed to a presentation), you can use this article to solve that issue (again, only for PC versions of PowerPoint supporting the ribbon):

http://www.experts-exchange.com/articles/17410/Initializing-PowerPoint-Events-with-VBA-and-Ribbon-XML.html
0
This article describes how to make a simple, pseudo-random number generator in Microsoft PowerPoint. The code checks the generated numbers against a list of numbers already generated to prevent duplication. We used this as a youth group activity but it could be adapted for other entertainment or competition purposes as well. This macro demonstrates the power of Visual Basic for Applications (VBA) in PowerPoint to obtain data from, and make dynamic changes to, elements of a slideshow at runtime.

This code generates pseudo-random numbers between 1 and 75. The lower and upper limits can be changed by setting the constants SMALLEST_NUMBER and BIGGEST_NUMBER, respectively, in the declarations area of the code. The macro also stores a list of the generated numbers (PickedNumbers private integer array) and checks to see if a newly generated number has already been selected and used. The generated numbers can be reset by clicking the asterisk button on the slide as the 'game' is running. Once all the possible numbers have been used, the macro disables the button to generate the next number and forces the user to press the reset button to continue.

The textbox is included for authenticity, as it allows the user to change the letter on the 'bingo ball'. Changes in this textbox are reflected on the 'bingo ball'. No letter needs to be entered.

To try this macro out, download the PPTX (for PowerPoint 2007 and up) or PPT and then open up VBA (for example, in …
1
LVL 24

Expert Comment

by:John Wilson
Lots of ways but you should ask this as a question in the main area. Include exactly what you aare trying to acheive.
0
LVL 49

Expert Comment

by:aikimark
In case anyone is interested in the behavior of the VB PRNG, I've republished my article on the subject here at EE: http:A_11114.html
0

Microsoft PowerPoint

PowerPoint is a slide show presentation program currently developed by Microsoft. PowerPoint presentations consist of a number of individual pages or "slides" that may contain text, graphics, sound, movies, and other objects, which may be arranged freely. The presentation can be printed, displayed live on a computer, or navigated through at the command of the presenter. Slides can also form the basis of webcasts.