VB 打开外部文件为什么为空呢.

来源:百度知道 编辑:UC知道 时间:2024/06/30 04:37:43
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
Option Explicit

Private Sub cmdHelp_Click()
Call ShellExecute(Me.hwnd, "Open", "系统说明书.htm", "", App.Path, 1)
End Sub
上面的代码有什么不对么,为什么打开的Word文件里什么内容也没有.

Call ShellExecute(Me.hwnd, "Open", App.Path & "\系统说明书.htm", "","", 1)

系统说明书.htm 这个格式为.html
你打开的是doc后缀的,相当于程序打开了(新建)空的"系统说明书.html"文件,当然是空白的了。或者你把那个doc文件名字改为"系统说明书.doc"试试。最好就是改为一直的后缀。