How do i open a powerpoint App directly from
VB.
Thank you.
Printable View
How do i open a powerpoint App directly from
VB.
Thank you.
Set a reference to the powerpoint COM, and instantiate the object. Then make it visible.
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.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
You can also use VB command
but i preferr the API because of its extended uses.Code:Shell "myapp.exe"
ie.
will open your internet browser and take you to that page.Code:ShellId = ShellExecute(0&, vbNullString, "www.vb-world.net", vbNullString, vbNullString, vbNormalFocus)
So it's very useful.
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
Instead of "Word.Application"
use "PowerPoint.Application".
If you use regedit you can find it under mycomputer\HKEY_CLASSES_ROOT