Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
Can anyone help me? ?? MVP ???
For two months I have posted and I still don't have an answer. How can I do a listBox with Hyper-links? I can do it with other lists both through the wizard or VB, but have been unsuccessful with hyper-links, all that is displayed is the friendly name or nothing at all! Is there an example out there that I can look at? I haven't found anything on the Web or Microsoft. Before posting, please try it for yourself. I have had comments that "try this, (example)" this should work, but it hasn't. The examples do work on normal lists. Thank you for your help. RK |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
What would be the purpose of a listbox with hyperlinks?
-- Vasant "RK" wrote in message ... Can anyone help me? ?? MVP ??? For two months I have posted and I still don't have an answer. How can I do a listBox with Hyper-links? I can do it with other lists both through the wizard or VB, but have been unsuccessful with hyper-links, all that is displayed is the friendly name or nothing at all! Is there an example out there that I can look at? I haven't found anything on the Web or Microsoft. Before posting, please try it for yourself. I have had comments that "try this, (example)" this should work, but it hasn't. The examples do work on normal lists. Thank you for your help. RK |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
I have 35+ spreadsheets, that based on the year and the
Quarter, I would be able to select the Hyper-link to the spreadsheet and send data to that particular spreadsheet to print. RK -----Original Message----- What would be the purpose of a listbox with hyperlinks? -- Vasant "RK" wrote in message ... Can anyone help me? ?? MVP ??? For two months I have posted and I still don't have an answer. How can I do a listBox with Hyper-links? I can do it with other lists both through the wizard or VB, but have been unsuccessful with hyper-links, all that is displayed is the friendly name or nothing at all! Is there an example out there that I can look at? I haven't found anything on the Web or Microsoft. Before posting, please try it for yourself. I have had comments that "try this, (example)" this should work, but it hasn't. The examples do work on normal lists. Thank you for your help. RK . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
A listbox has a click event and in that event you can do whatever you want
with the item(s) selected in the listbox. The listbox doesn't support a hyperlink per se, but using the click event, as I said, you should be able to do what you describe. And yes, I have done similar. -- Regards, Tom Ogilvy "RK" wrote in message ... I have 35+ spreadsheets, that based on the year and the Quarter, I would be able to select the Hyper-link to the spreadsheet and send data to that particular spreadsheet to print. RK -----Original Message----- What would be the purpose of a listbox with hyperlinks? -- Vasant "RK" wrote in message ... Can anyone help me? ?? MVP ??? For two months I have posted and I still don't have an answer. How can I do a listBox with Hyper-links? I can do it with other lists both through the wizard or VB, but have been unsuccessful with hyper-links, all that is displayed is the friendly name or nothing at all! Is there an example out there that I can look at? I haven't found anything on the Web or Microsoft. Before posting, please try it for yourself. I have had comments that "try this, (example)" this should work, but it hasn't. The examples do work on normal lists. Thank you for your help. RK . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
"RK" wrote ...
I have 35+ spreadsheets, that based on the year and the Quarter, I would be able to select the Hyper-link to the spreadsheet and send data to that particular spreadsheet to print. Try this general approach: capture the workbook name and folder with: cell.Hyperlinks(1).Address and the range with: cell.Hyperlinks(1).SubAddress and use this info to open the workbook, 'send' the data to the range and print it out. Before posting, please try it for yourself. I have had comments that "try this, (example)" this should work, but it hasn't. Fair enough: Option Explicit Private Sub UserForm_Initialize() Dim cell As Range Me.ListBox1.ColumnCount = 2 Me.ListBox1.BoundColumn = 1 For Each cell In Sheet1.Range("AC2:AC69").Cells Me.ListBox1.AddItem cell.Hyperlinks(1).Address Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = _ cell.Hyperlinks(1).SubAddress Next cell End Sub Private Sub CommandButton2_Click() Dim i As Long Dim wb As Excel.Workbook Dim ws As Excel.Worksheet Dim rng As Excel.Range For i = 0 To Me.ListBox1.ListCount - 1 If Me.ListBox1.Selected(i) Then Set wb = Application.Workbooks.Open(ListBox1.List(i, 0)) Set ws = wb.Worksheets(Left$(ListBox1.List(i, 1), _ InStr(ListBox1.List(i, 1), "!") - 1)) Set rng = ws.Range(Mid$(ListBox1.List(i, 1), _ InStr(ListBox1.List(i, 1), "!") + 1)) With rng .Value = 99 .PrintOut End With End If Next i End Sub Jamie. -- |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
Thank you for your reply,
The problem that I still have, is that the list box is blank. ? ? ? I still don't understand why. And I have looked for examples on the Internet without any success. Thank you again for your reply. RK -----Original Message----- "RK" wrote ... I have 35+ spreadsheets, that based on the year and the Quarter, I would be able to select the Hyper-link to the spreadsheet and send data to that particular spreadsheet to print. Try this general approach: capture the workbook name and folder with: cell.Hyperlinks(1).Address and the range with: cell.Hyperlinks(1).SubAddress and use this info to open the workbook, 'send' the data to the range and print it out. Before posting, please try it for yourself. I have had comments that "try this, (example)" this should work, but it hasn't. Fair enough: Option Explicit Private Sub UserForm_Initialize() Dim cell As Range Me.ListBox1.ColumnCount = 2 Me.ListBox1.BoundColumn = 1 For Each cell In Sheet1.Range("AC2:AC69").Cells Me.ListBox1.AddItem cell.Hyperlinks(1).Address Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = _ cell.Hyperlinks(1).SubAddress Next cell End Sub Private Sub CommandButton2_Click() Dim i As Long Dim wb As Excel.Workbook Dim ws As Excel.Worksheet Dim rng As Excel.Range For i = 0 To Me.ListBox1.ListCount - 1 If Me.ListBox1.Selected(i) Then Set wb = Application.Workbooks.Open(ListBox1.List(i, 0)) Set ws = wb.Worksheets(Left$(ListBox1.List(i, 1), _ InStr(ListBox1.List(i, 1), "!") - 1)) Set rng = ws.Range(Mid$(ListBox1.List(i, 1), _ InStr(ListBox1.List(i, 1), "!") + 1)) With rng .Value = 99 .PrintOut End With End If Next i End Sub Jamie. -- . |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
"RK" wrote ...
The problem that I still have, is that the list box is blank. ? ? ? I still don't understand why. And I have looked for examples on the Internet without any success. Try he http://msdn.microsoft.com/library/de...hsProperty.asp Jamie. -- |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
Jamie,
Well, all that seams to do is make the ListBox bigger, but still displays empty. Have you tried to create a hyper-link to a couple of spreadsheets and tried this? You will see what I mean. Thank you for your help RK -----Original Message----- "RK" wrote ... The problem that I still have, is that the list box is blank. ? ? ? I still don't understand why. And I have looked for examples on the Internet without any success. Try he http://msdn.microsoft.com/library/default.asp? url=/library/en- us/off2000/html/rerefColumnWidthsProperty.asp Jamie. -- . |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
"RK" wrote ...
Well, all that seams to do is make the ListBox bigger, but still displays empty. I thought you may have made one of your columns zero width i.e. not visible. You did in earlier code: http://groups.google.com/groups?selm...0a%40p hx.gbl Me.ListBox1.ColumnWidths = "0;1" But this is just one of a number of listbox properties that affect whether columns are visible. Take another look at MSDN. Have you tried to create a hyper-link to a couple of spreadsheets and tried this? You will see what I mean. Yes, the following code works for me: http://groups.google.com/groups?selm...g .google.com Jamie. -- |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox and Hyperlinks
Jamie,
I am not sure why this isn't working. I have deleted all my code then cut and pasted your code, watching for word wrap. Compiled the code, no errors. But the problem still persist. The list box show empty. ?? Thank you for your replys. I am just as confused as before. It should work. RK -----Original Message----- "RK" wrote ... Well, all that seams to do is make the ListBox bigger, but still displays empty. I thought you may have made one of your columns zero width i.e. not visible. You did in earlier code: http://groups.google.com/groups?selm=c22701c4386e% 24494eb730%24a401280a%40phx.gbl Me.ListBox1.ColumnWidths = "0;1" But this is just one of a number of listbox properties that affect whether columns are visible. Take another look at MSDN. Have you tried to create a hyper-link to a couple of spreadsheets and tried this? You will see what I mean. Yes, the following code works for me: http://groups.google.com/groups? selm=2ed66b75.0406160344.14b90fcb%40posting.google .com Jamie. -- . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
Hyperlinks in listbox | Excel Discussion (Misc queries) | |||
Multicolumn Listbox and ordinary listbox | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |