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 LongPrivate Sub Command1_Click() On Error GoTo Errhandle ShellExecute Me.hwnd, "open", "C:\aa.ppt", vbNullString, vbNullString, 1 Exit SubErrhandle: MsgBox Err.Description & "!", vbInformation End Sub
方法一: 调用两个API函数“shellexecute"和"getdesktopwindow" Option Explicit 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 LongPrivate Declare Function GetDesktopWindow Lib "user32" () As LongPrivate Const SW_SHOWMAXIMIZED = 3Private Sub Command1_Click() Dim pat pat = "c:\1.ppt" '假设是你所放文件的路径 ShellExecute GetDesktopWindow(), "open", pat, pat, "C:\", SW_SHOWMAXIMIZED方法二: 在”工程\应用\"里面直接应用相应的可插入对象也可以! End Sub
On Error GoTo Errhandle
ShellExecute Me.hwnd, "open", "C:\aa.ppt", vbNullString, vbNullString, 1
Exit SubErrhandle:
MsgBox Err.Description & "!", vbInformation
End Sub
调用两个API函数“shellexecute"和"getdesktopwindow"
Option Explicit
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 LongPrivate Declare Function GetDesktopWindow Lib "user32" () As LongPrivate Const SW_SHOWMAXIMIZED = 3Private Sub Command1_Click()
Dim pat
pat = "c:\1.ppt" '假设是你所放文件的路径
ShellExecute GetDesktopWindow(), "open", pat, pat, "C:\", SW_SHOWMAXIMIZED方法二:
在”工程\应用\"里面直接应用相应的可插入对象也可以!
End Sub