|
-
Oct 2nd, 2000, 09:51 AM
#1
Thread Starter
New Member
How do i open a powerpoint App directly from
VB.
Thank you.
-
Oct 2nd, 2000, 10:13 AM
#2
Fanatic Member
Set a reference to the powerpoint COM, and instantiate the object. Then make it visible.
r0ach™
Don't forget to rate the post
-
Oct 2nd, 2000, 10:19 AM
#3
Lively Member
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
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.
-
Oct 3rd, 2000, 09:43 AM
#4
Thread Starter
New Member
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
-
Oct 4th, 2000, 05:08 AM
#5
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|