Private Declare n ShellExecute Lib "shell32.dll"Alias"ShellExecuteA"(ByVal hwnd As Long, ByVal lpOperationAsString,  ByVal lpFile As String, ByVal lpmeters As String,  ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long  Private Const SW_SHOWNORMAL = 1  然后在过程中调用:  private Sub CmdHelp_Click()dim a as long  Dim b As String  b = App.Path & "\help.chm" "用变量b记录与主程序同目录下的help.chm帮助文件  a = ShellExecute (0, "open", b, "", "", SW_SHOWNORMAL)  End Sub我想用这段代码,可总是报错,请问是怎么会是

解决方案 »

  1.   

    重复贴。注意App.Path如果在根目录下会多返回一个 "\"
      

  2.   

    改好了:
    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 Const SW_SHOWNORMAL = 1Private Sub CmdHelp_Click()
    Dim a As Long
    Dim b As String
    b = App.Path & "\help.chm" '用变量b记录与主程序同目录下的help.chm帮助文件
    a = ShellExecute(Me.hwnd, "open", b, "", "", SW_SHOWNORMAL)
    End Sub
      

  3.   

    Private Declare Function ShellExecute ...........
              ByVal lpOperation As String,
    你把第二个参数:ByVal lpOperation As String
    写成了:ByVal lpOperationAsString
    是最致命的地方…………
      

  4.   

    Set s = CurrentDb.OpenRecordset("select HelpKey from tblhelp where FormName='&第一个窗体&' and  ControlName='&第一个控件& '")
    我想问怎样取得查询的结果,对它操作,我要用这个查询来的字段值,是唯一的,实际上不是一个集合,   a = HtmlHelp(0, b, 0, s)用在这里,S的地方应该怎么写。我没有分了,不能发帖子。