Open powerpoint file in Visual Basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guto
    New Member
    • Jun 2007
    • 3

    Open powerpoint file in Visual Basic

    Hi!

    I don't know how to open a powerpoint file in Visual Basic!

    I'd appreciate the help!
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Sure,

    For creating a new presentation use:
    [CODE=vb]Sub NewPPT()
    Dim Obj1 As Object
    Set Obj1 = CreateObject("p owerpoint.appli cation")
    Obj1.Presentati ons.Add
    Obj1.Visible = True
    End Sub[/CODE]

    for opening an existing one:

    [CODE=vb]Sub OpenPPT()
    Dim Obj1 As Object
    Set Obj1 = CreateObject("p owerpoint.appli cation")
    Obj1.Presentati ons.Open Filename:="C:\p resentation1.pp t"
    Obj1.Visible = True
    End Sub[/CODE]

    Good Luck

    Kad

    Comment

    • guto
      New Member
      • Jun 2007
      • 3

      #3
      Hi!

      When I command to create a new presentation it works.

      But when I command to open a presentation it doesn't work.

      I had writeen this code:

      Private Sub Command1_Click( )
      Dim Obj1 As Object
      Set Obj1 = CreateObject("p owerpoint.appli cation")
      Obj1.Presentati ons.Open FileName:="C:\d vd.pps"
      Obj1.Visible = True
      End Sub

      I'd appreciate the help!

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        Originally posted by guto
        Hi!

        When I command to create a new presentation it works.

        But when I command to open a presentation it doesn't work.

        I had writeen this code:

        Private Sub Command1_Click( )
        Dim Obj1 As Object
        Set Obj1 = CreateObject("p owerpoint.appli cation")
        Obj1.Presentati ons.Open FileName:="C:\d vd.pps"
        Obj1.Visible = True
        End Sub

        I'd appreciate the help!
        Hi... (sorry for the delay)

        Sometimes it happens with powerpoint that you have to make the object visible before you open a file, i dont know why is this, but certainly it works most of the times, then why dont you try it out?"

        [CODE=vb]Private Sub Command1_Click( )
        Dim Obj1 As Object
        Set Obj1 = CreateObject("p owerpoint.appli cation")
        Obj1.Visible = True
        Obj1.Presentati ons.Open FileName:="C:\d vd.pps"
        End Sub[/CODE]

        Good Luck

        Comment

        Working...