下面的代碼是調用系統默認程序打開PDF,注意修改文件路徑D:\help.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 Long
Private Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
Dim result
result = ShellExecute(0, vbNullString, "D:\help.pdf", vbNullString, vbNullString, SW_SHOWNORMAL)
If result <= 32 Then
MsgBox "打開失敗!", vbOKOnly + vbCritical, "錯誤:", 0
End If
End Sub
Ⅱ 用VB6怎麼打開Adobe Reader 並同時打開一個*.pdf文件
Shell "<Adobe Reader程序路徑> <pdf文件自路徑>"(Adobe Reader和pdf文件之間有空格)
比如Adobe Reader安裝在 d:\Software\Adobe\AcroRd32.exe
要打開的pdf是 d:\1.pdf
代碼就是 Shell "d:\Software\Adobe\AcroRd32.exe d:\1.pdf"
Ⅲ vb 打開PDF文件
利用AcroPDF打開並顯示PDF文件。
注意:必須事先安裝免費的 Adobe Reader 11.0
(1)創建一個VB6工程。在工具欄中點擊滑鼠右鍵,調出右鍵菜單-->部件-->Adobe Acrobat 7.0 Control Type Library 1.0-->確定