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()
Dim Sfile As String
Dim lR As Long
Sfile = App.Path & "\调整.pdf"
lR = ShellExecute(Me.hWnd, "Open", Sfile, "", "", vbNormalFocus)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'关闭打开的文件  App.Path & "\调整.pdf"
这里怎么写
End Sub

解决方案 »

  1.   

    改用Shell写的,你可以参考一下Option Explicit'打开文件
    Private Sub Command1_Click()
        Dim Sfile As String
        Dim lR As Long
        Sfile = "D:\Login.bmp"
        lR = Shell("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe d:\雨林木风 WinXP SP2 安装版 Y3.5.pdf", vbNormalFocus)
        Command1.Caption = lR
    End Sub'关闭文件
    Private Sub Command2_Click()
        Dim lngP As Long
        If IsNumeric(Command1.Caption) Then Shell "taskkill.exe /PID " & Command1.Caption
    End Sub