Open PDF from Listbox entry

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone help me with this?

I have some entries in a listbox, and i want to open a pdf-document when
double-clicking on a row.
I want to connect different pdf's to each row in the listbox.

I'm looking for something analouge to this:
me.Command89.HyperlinkAddress = "C:\OurDocuments\mypdf.pdf"


Thanks!
 
Thank you, but i cant get this to work.

maybe i need a little more details on how to use this
apiShellExecute-function.
Can you please add this function to your reply, as it should be written in
the code?
 
Can anyone help me with this?

I have some entries in a listbox, and i want to open a pdf-document when
double-clicking on a row.
I want to connect different pdf's to each row in the listbox.

I'm looking for something analouge to this:
me.Command89.HyperlinkAddress = "C:\OurDocuments\mypdf.pdf"

Thanks!

I'll assume the list box contains the name of the pdf document and
that all of the documents are stored in the same folder.

Applicatiom.FollowHyperlink "C:\OurDocuments\" & Me.ListBoxName &
".pdf"
 
Hi,
just copy/paste function definition as below to a new module

Declare Function apiShellExecute 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

Declare Function GetDesktopWindow Lib "user32" () As Long

Public Const SW_NORMAL = 1
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWDEFAULT = 10
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOWNORMAL = 1

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 
Thanks!
Now it works perfectly!

I corrected a few type-o's in this:
apiShellExecute GetDesktopWindow(), "open",""C:\OurDocuments\" &
me.listbox1 & ".pdf" , , "", 0&, SW_SHOWMAXIMIZED
 
Back
Top