我想让程序自动调用与PDF文件相关联的软件打开PDF文件,从网上查到了一段代码:
   
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()
    ShellExecute Me.hwnd, "open", "d:\mc\123.pdf", vbNullString, vbNullString, 3
   
End Sub
但是执行的时候却提示编译错误 ,在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
处出错。
哪位大哥帮忙解决一下呀?

解决方案 »

  1.   

    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
      

  2.   

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" 这句话什么意思呀?
      

  3.   

    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应该放到什么地方呀?我就是这样做的,但总是出错:
       编译错误: 
        在End Sub、End Function 或End属性后面只能出现注释