Open Multiple PDF's from List Box

themanof83

Registered User.
Local time
Today, 15:37
Joined
May 1, 2008
Messages
73
Hey Guys,

Tell me if I'm trying the impossible here......

I have a list box that lists a number of tests, these test all have PDF's associated with them. At the moment I select one then click a button which creates a hyperlink using information associated with the record in the list box. This works perfectly and is done as follows (don't worry about the first bit):

Code:
If Me. blah blah blah then
   Me. blah blah 
Else
   Application.FollowHyperlink "C:\My Documents\" & _
   Me.ListBox.Column(2) & "\" &_
   Me.ListBox.Column(0) & ".PDF"
End

Now, I would like to have the list box as a multi-select list so that I can open a (limited) number of PDF's at a time. The only way I can invisige this is by putting in a do loop to carry out the above operation one line at a time. Sort of like this.

Code:
If Me. blah blah blah then
   Me. blah blah 
Else
   If Me.ListBox.Selected > 1 then
   
   Do loop for number of selected lines
      Application.FollowHyperlink "C:\My Documents\" & _
      Me.ListBox.Column(2) & "\" &_
      Me.ListBox.Column(0) & ".PDF"
   End Do

   Else
      Application.FollowHyperlink "C:\My Documents\" & _
      Me.ListBox.Column(2) & "\" &_
      Me.ListBox.Column(0) & ".PDF"
End

I just need a little help getting started as I'm fairly new........!!!
Thanx in advance.
 
I would do this:
Code:
dim c as control, introw as integer

c = me.listbox

If Me. blah blah blah then
   Me. blah blah 
Else

   for introw = 0 to c.listcount - 1
   
      if c.selected(introw) then
         Application.FollowHyperlink "C:\My Documents\" & _
         c.Column(2, introw) & "\" &_
         c.Column(0, introw) & ".PDF"
      end if
   next introw

end if
 

Users who are viewing this thread

Back
Top Bottom