Hi
I am new to V.B and would be gratefule for any help/advice with my first VB project.
How to automatically start Acrobat Reader when user clicks on the command button and the.PDF file opens up.
Printable View
Hi
I am new to V.B and would be gratefule for any help/advice with my first VB project.
How to automatically start Acrobat Reader when user clicks on the command button and the.PDF file opens up.
put a text box and a command buttom on a form and copy this code into the declarations section of the form
type the filenem into the text box and click the command button
Code: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()
Call ShellExecute(0&,vbNullString,text1.Text, vbNullString, _
vbNullString, vbNormalFocus)
End Sub
hi markQuote:
Originally posted by Mark Sreeves
put a text box and a command buttom on a form and copy this code into the declarations section of the form
type the filenem into the text box and click the command button
Code: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()
Call ShellExecute(0&,vbNullString,text1.Text, vbNullString, _
vbNullString, vbNormalFocus)
End Sub
And with a dbclick() in a listbox?? i put list1.text and it doesn´t work
thanks
Thanks Mark
i just had to enter this.
Private Sub Command1_Click()
Dim RetVal
RetVal = ShellExecute(Form2.hwnd, "open", _
"\Email+V5\Docs\network.pdf", "", "\Docs", SW_RESTORE)
End Sub
Because the .pdf files will reside on the CD-ROM
the only way it would work was after i entered
Dim RetVal= shellExecute in the Command1_Click.
fmnunes, this works for me!
Code:Option Explicit
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 Form_Load()
List1.AddItem "C:\Acrobat3\Reader\Acrobat.pdf"
List1.AddItem "C:\Acrobat3\Reader\License.pdf"
End Sub
Private Sub List1_DblClick()
Dim filename As String
filename = List1.Text
Call ShellExecute(0&, vbNullString, filename, vbNullString, _
vbNullString, vbNormalFocus)
End Sub