Results 1 to 5 of 5

Thread: Powerpoint

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Li,ny,us
    Posts
    4

    Question

    How do i open a powerpoint App directly from
    VB.

    Thank you.

  2. #2
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    Set a reference to the powerpoint COM, and instantiate the object. Then make it visible.

    r0ach™
    Don't forget to rate the post

  3. #3
    Lively Member
    Join Date
    May 2000
    Location
    Norway
    Posts
    112
    Code:
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    Sub Main()
      Dim ShellId As Long
      'If you want to execute the application
      ShellId = ShellExecute(0&, vbNullString, "c:\power\pp.exe", vbNullString, vbNullString, vbNormalFocus)
      'If you want to open a PP-file
      ShellId = ShellExecute(0&, "open", "c:\mypp.ppt", vbNullString, vbNullString, vbNormalFocus)
      'If you want to open a PP-file as a template (New)
      ShellId = ShellExecute(0&, "new", "c:\mypp.ppt", vbNullString, vbNullString, vbNormalFocus)
    End Sub
    The "open" and "new" are the actions you find in windows if you look at the file assosiations. I think you can do a "print" to but have never tried.

    You can also use VB command
    Code:
    Shell "myapp.exe"
    but i preferr the API because of its extended uses.

    ie.
    Code:
      ShellId = ShellExecute(0&, vbNullString, "www.vb-world.net", vbNullString, vbNullString, vbNormalFocus)
    will open your internet browser and take you to that page.
    So it's very useful.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Li,ny,us
    Posts
    4

    PowerPoint

    Actually I am trying to create an object that I can use within vb Just like the one below
    that uses Word.
    I am trying to open a powerpoint and I cant find any examples how to do it?
    Any help will be very appreciated.
    Thank you,


    Set WordObj = CreateObject("Word.Application")
    WordObj.Documents.Open (txtSource.Text)
    'Disable viewing the Word session
    'and its document
    WordObj.Visible = False

    WordObj.Quit savechanges:=False
    Set WordObj = Nothing


  5. #5
    Lively Member
    Join Date
    May 2000
    Location
    Norway
    Posts
    112
    Instead of "Word.Application"
    use "PowerPoint.Application".

    If you use regedit you can find it under mycomputer\HKEY_CLASSES_ROOT

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width