none
Displaying power point in a form of VB

    Question

  • Please I need a help on how to add a power point slide from a file onto a form and control it using buttons

    Monday, April 24, 2017 10:20 AM

All replies

  • Hi Amina,

    Based on your description, I guess you want to load one PowerPoint file in the VB.net. If yes, please refer to the code below.

    Note: please right-click Add Reference..--- add Microsoft.Office.Interop.PowerPoint.dll

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim ppApp As New Microsoft.Office.Interop.PowerPoint.Application()
            ppApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue
            Dim oPresSet As Microsoft.Office.Interop.PowerPoint.Presentations = ppApp.Presentations
            Dim oPres As Microsoft.Office.Interop.PowerPoint._Presentation = oPresSet.Open("D:\test\VB.pptx", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue)
    
        End Sub

    Hope it is helpful to you.

    Best regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 26, 2017 3:14 AM
    Moderator
  • You might want to try the OLE Container Surrogate component to display your PowerPoint document:

    https://www.codeproject.com/Tips/487566/OLE-container-surrogate-for-NET

    There is nothing included in .NET for embedding Office documents into Windows Forms.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, April 26, 2017 1:38 PM