Hyperlinks from UserForm Controls

  • Thread starter Thread starter Nigel
  • Start date Start date
N

Nigel

I have the following situation

I have a worksheet database in which there are 4 columns in which hyperlinks
can be added.

On a userform there are 4 controls that the user can enter a hyperlink as a
text string (path and file), which are subsequently stored in the database
as strings.

1. I do not appear to be able to store them as hyperlinks on the worksheet,
is there a method for doing this. Or can I / do I need to use the standard
hyperlink form in Excel to establish the link correctly ?

2. Having crerated the links, is it possible to activate the links from
within the UserForm, I have tried using the hyperlinks collection (having
manually set some up) but it appears in order to do this I need to maintain
an index of where all the links are. I would much prefer to click the
UserForm control to open the link

I am developing in Excel 2002 but need to make it compatible with Excel 97

TIA
Nigel
 
Turn on the macro recorder and right click on a cell, then select insert
hyperlink. Put in a link

Turn off the macro recorder. This will give you the syntax you need to
create a hyperlink with code. You just adjust the arguments to accept
information from your userform.

In the click event of the userform, you would just pick up the information
of the appropriate hyperlink from the worksheet and use the followhyperlink
method - populating the arguments from the elements of the hyperlink.

--
Regards,
Tom Ogilvy


Nigel said:
I have the following situation

I have a worksheet database in which there are 4 columns in which hyperlinks
can be added.

On a userform there are 4 controls that the user can enter a hyperlink as a
text string (path and file), which are subsequently stored in the database
as strings.

1. I do not appear to be able to store them as hyperlinks on the worksheet,
is there a method for doing this. Or can I / do I need to use the standard
hyperlink form in Excel to establish the link correctly ?

2. Having crerated the links, is it possible to activate the links from
within the UserForm, I have tried using the hyperlinks collection (having
manually set some up) but it appears in order to do this I need to maintain
an index of where all the links are. I would much prefer to click the
UserForm control to open the link

I am developing in Excel 2002 but need to make it compatible with Excel 97

TIA
Nigel







----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Tom

Thanks for the tips.

The following gives me the direct link from the userform control (tblink)
without adding anything to the worksheet. It works but is it the correct
method? If I save the tblink.value to my workbook database via an array it
is stored in the workbook as text, this same value is reloaded from the
workbook into tblink via an array and availble again to link to.

My concern is that I have not added any hyperlinks to the workbook is this
necessary?

code snippet from userform event......

Private Sub tbLink_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
ActiveWorkbook.FollowHyperlink Address:=tbLink.Value, _
NewWindow:=True
End Sub


Cheers
Nigel
 
If you have the correct argument for address stored as a string somewhere,
then that should work. FollowHyperlink just requires a valid string
argument - it doesn't have to be associated with an existing hyperlink. My
suggestion was based on my understanding of what your situation was/is.

--
Regards,
Tom Ogilvy


Nigel said:
Tom

Thanks for the tips.

The following gives me the direct link from the userform control (tblink)
without adding anything to the worksheet. It works but is it the correct
method? If I save the tblink.value to my workbook database via an array it
is stored in the workbook as text, this same value is reloaded from the
workbook into tblink via an array and availble again to link to.

My concern is that I have not added any hyperlinks to the workbook is this
necessary?

code snippet from userform event......

Private Sub tbLink_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
ActiveWorkbook.FollowHyperlink Address:=tbLink.Value, _
NewWindow:=True
End Sub


Cheers
Nigel






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Back
Top