PPT.WorkWithMediaPlayer in MS PowerPoint 2010 to Work with Methods of Player Class in VB.NET
In this article I am going to explain about how to work with methods of player class in a Microsoft PowerPoint 2010 presentation.
Introduction
In this article I am going to explain about how to work with methods of player class in a Microsoft PowerPoint 2010 presentation. For this we use PPT.WorkWithMediaPlayer in Microsoft PowerPoint 2010. Using PPT.WorkWithMediaPlayer you can Work with various Methods of Player Class in a Microsoft PowerPoint 2010 presentation.
In this application you have to insert a video in your presentation. For this click on insert tab and then click on Video then Video from file. Now select video file then click on insert.
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
Private shapeID As Integer
Private plyr As Player
Sub TestPlayer()
Dim shp As Shape
For Each shp In ActivePresentation.Slides(1).Shapes
' Find the first media shape on the slide:
If shp.Type = msoMedia Then
shapeID = shp.id
Exit For
End If
Next shp
' Add some bookmarks to the media. Delete all existing bookmarks
' first, so you can execute this code multiple times.
Dim i As Integer
With shp.MediaFormat
For i = .MediaBookmarks.Count To 1 Step -1
.MediaBookmarks(i).Delete()
Next i
End With
With shp.MediaFormat.MediaBookmarks
.Add(1000, "Bookmark 1")
.Add(5000, "Bookmark 2")
.Add(8000, "Bookmark 3")
End With
' Store away a reference to the Player instance.
plyr = Application.Windows(1).View.Player(shapeID)
End Sub
Sub Play()
plyr.Play()
End Sub
Sub Pause()
plyr.Pause()
End Sub
Sub GotoNextBookmark()
plyr.GotoNextBookmark()
End Sub
Sub GotoPreviousBookmark()
plyr.GotoPreviousBookmark()
End Sub
Sub GotoPosition()
plyr.CurrentPosition = 4000
End Sub
Steps for creating Application
Step 1 : Start Microsoft PowerPoint 2010 :
Step 2 : Now you have to insert a video in your presentation. For this click on insert tab and then click on video ==> Video from file :
Step 3 : Now select video file then click on insert :
Step 4 : Now you have video in presentation :
Step 5 : Using Alt + F11 Key Start Visual Basic for Applications (VBA) Window :
Step 6 : Select on VBAProject(Presentation 1) :
Step 7 : Right Click On VBAProject(Presentation 1) ==> Goto Insert==> Goto Module & click on Module:
Step 8 : Write Code in Visual Basic for Applications (VBA) Window :
Step 9 : Run Application using F5 :
Step 10 : Macros window will open, Select Macros name and click on Run Button :
Step 11 : Output of Application :