PPT.MediaFormatProperties in MS PowerPoint 2010 to Modify Aspects of Videos in VB.NET

In this article I am going to explain about how to modify various aspects of a video in a Microsoft PowerPoint 2010 presentation.
  • 1976

Introduction

In this article I am going to explain about how to modify various aspects of a video in a Microsoft PowerPoint 2010 presentation. For this we use  PPT.MediaFormatProperties in Microsoft PowerPoint 2010. Using  PPT.MediaFormatProperties we can modify various aspects of a video in a Microsoft PowerPoint 2010 presentation by using the MediaFormat property and how to list several of the video's properties settings.

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

    Dim vip As Shape
    For Each vip In ActivePresentation.Slides(1).Shapes

        ' Is it a media shape? 
        If vip.Type = msoMedia Then
            Debug.Print("Media Element: " & vip.Name)
            DisplayMediaFormatInfo(vip)
 
            ' Work with the MediaFormat property: 
            With vip.MediaFormat                

              ' It set the start and end point of video
                .StartPoint = 2000
                .EndPoint = 5000
                .FadeInDuration = 500
                .FadeOutDuration = 500 
                 
                .Muted = False
                .Volume = 0.25
            End With
            Debug.Print("================")
            DisplayMediaFormatInfo(vip)
        End If
    Next vip

End
 Sub
 

Private
 Sub DisplayMediaFormatInfo(vip As Shape)
    With vip.MediaFormat

        ' Retrieve all the useful properties: 
        Debug.Print(vbTab & "AudioCompressionType: " & .AudioCompressionType)
        Debug.Print(vbTab & "AudioSamplingRate: " & .AudioSamplingRate)
        Debug.Print(vbTab & "EndPoint: " & .EndPoint)
        Debug.Print(vbTab & "FadeInDuration: " & .FadeInDuration)
        Debug.Print(vbTab & "FadeOutDuration: " & .FadeOutDuration)
        Debug.Print(vbTab & "IsEmbedded: " & .IsEmbedded)
        Debug.Print(vbTab & "IsLinked: " & .IsLinked)
        Debug.Print(vbTab & "Length: " & .Length)
        Debug.Print(vbTab & "Muted: " & .Muted)
        Debug.Print(vbTab & "ResamplingStatus: " & .ResamplingStatus)        
        Debug
.Print(vbTab & "SampleHeight: " & .SampleHeight)
        Debug.Print(vbTab & "SampleWidth: " & .SampleWidth)
        Debug.Print(vbTab & "StartPoint: " & .StartPoint)
        Debug.Print(vbTab & "VideoCompressionType: " & .VideoCompressionType)
        Debug.Print(vbTab & "VideoFrameRate: " & .VideoFrameRate)
        Debug.Print(vbTab & "Volume: " & .Volume)

    End With

End
 Sub

Steps for creating Application

Step 1 : Start Microsoft PowerPoint 2010 : 
 

1.jpg
 

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

Clipboard07.jpg
 

Step 3 : Now select video file then click on insert.

Clipboard08.jpg
 

Step 4 : Now you have video in presentation.

Clipboard10.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 :

Clipboard04.jpg
 

Step 9 : Run Application using F5 :

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

Clipboard06.jpg
 

Step 11: Output of Application :

  • Starting of video

    Clipboard01.jpg

     
  • End of video

    Clipboard02.jpg

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.