PDA

View Full Version : How to load hyperlinks in userform listview



kishlaya
09-01-2009, 12:54 AM
Dear Friends :hi:
I have userform containing a listview, which takes the input data from one sheet. various coulmns of the sheet appear as the subitems of the listview in the same way.
one of these columns of the sheet contains hyperlinks. but when this column's data is loaded into the useform it comes as plain text but not as hyper link.
is there a way to make it possible. there are around 5000 rows which will be getting loaded in the useform.

Any help is appreciated.:help
Thanks in advance!
Regards,
Kishlaya

mdmackillop
09-01-2009, 05:18 AM
I suspect the name ListView gives the clue. It will show a list, but not full cell functionality. It should be simple enough to call the link using FollowHyperlink

kishlaya
09-01-2009, 05:23 AM
HI there

Thanks for the response..
i tried giving the followhyperlink, but i am not able to code it in the click event of the subitem.
Regards,
Kishlaya

mdmackillop
09-01-2009, 06:05 AM
Is S.No unique?

kishlaya
09-01-2009, 06:07 AM
yes the serial number is unique.
how can i access a particular cell of the listbox(with gridlines in it)?

Regards,
Kishlaya

mdmackillop
09-01-2009, 06:10 AM
Try

Private Sub ListView1_Click()
Dim c As Range
Set c = Columns(1).Find(ListView1.SelectedItem, lookat:=xlWhole).Offset(, 3)
ActiveWorkbook.FollowHyperlink c.Hyperlinks(1).Address
End Sub

kishlaya
09-01-2009, 06:22 AM
hey there
thanks for the code. :)
it is working partially to the most. when i select any ccolumn in the listview for a given row it opens the link, it shd open only when i select the particular cell in the listview.

P.S:The cells and columns, rows mentioned above are the ones present in the listview NOT the ones in the excel sheet.
Regrds,
Kishlaya

mdmackillop
09-01-2009, 06:40 AM
I'm not that familiar with ListView, but assume that a grid can be referenced. Does it contain the full hyperlink path?
You could also use a DoubleClick event for the code provided.

kishlaya
09-01-2009, 11:48 PM
hi there
i gave your code to the double click event. but there are few problems.
1. it shows an error if the cell is not a hyperlink.
2. if the user clicks any other column in the list view it goes to the hyperlink, it shd go only in the case wen the it is clicked in that cell of the listview.

Hope i get soln out for it.
Regards,
Kishlaya

mdmackillop
09-02-2009, 12:41 AM
These are not cells in listview. You are clicking/double clicking a line of values.
If there is no hyperlink for a particular row, build in error handling.