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 Sub Command1_Click() Dim file As String file = "c:\123.doc" ShellExecute 0, "open", file, vbNullString, vbNullString, 5 End Sub
Set WordApp = New Word.Application WordApp.Documents.add '添加路径 WordApp.Visible = true ................................ WordApp.Quit False Set WordApp = Nothing
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()
Dim file As String
file = "c:\123.doc"
ShellExecute 0, "open", file, vbNullString, vbNullString, 5
End Sub
WordApp.Documents.add '添加路径
WordApp.Visible = true
................................
WordApp.Quit False
Set WordApp = Nothing