怎么让vb用对话框选择word文件并打开
想请问一下各位大侠,我想用对话框选择word文件,然后并打开这个word文件,怎么实现啊???
[解决办法]
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 Long
Private Sub Command1_Click()
On Error GoTo EH
With CommonDialog1
.Filter = "Word file(*.doc)
[解决办法]
*.doc"
.CancelError = True
.ShowOpen
ShellExecute Me.hwnd, "", .FileName, "", "", 1
End With
Exit Sub
EH:
If Err.Number = 32755 Then Exit Sub
MsgBox "Realtime Error: " & Err.Number & vbCrLf & Err.Description
End Sub