|
-
Mar 19th, 2000, 05:19 PM
#1
Thread Starter
New Member
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.
-
Mar 19th, 2000, 06:06 PM
#2
Frenzied Member
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
-
May 16th, 2000, 03:41 PM
#3
Junior Member
ListBox
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
hi mark
And with a dbclick() in a listbox?? i put list1.text and it doesn´t work
thanks
-
May 16th, 2000, 04:20 PM
#4
Thread Starter
New Member
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.
-
May 23rd, 2000, 05:16 PM
#5
Frenzied Member
fmnunes
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|