You could add a label to the userform and format the text to look like a
hyperlink (blue, underlined). Then use the Label's _Click event to search for
the file--using application.getopenfilename.
Personally, I would think a browse commandbutton would look more natural to a
user.
Option Explicit
Private Sub Label1_Click()
Dim myFileName As Variant
Dim NextRow As Long
With ActiveSheet
NextRow = .Cells(.Rows.Count, "F").End(xlUp).Row + 1
End With
myFileName = Application.GetOpenFilename(filefilter:="All Files, *.*")
If myFileName = False Then
Beep 'do nothing???
Else
ActiveSheet.Cells(NextRow, "F").Formula _
= "=hyperlink(""file:////""&" _
& """" & myFileName & """,""click me"")"
End If
End Sub
zak wrote:
Hi Dave
I have been looking for some hyperlink help and have found your posts have
been quite helpful to others, and so i thought you may be able to help me
with a problem i am having.
I have a form to enter text (and the text gets copied to a worksheet). But
within the form I would like to add a browse button to find a file, which
then adds the path of that file to colmun H as a hyperlink in the same
worksheet...so that when you click on the hyperlink, the file opens up. The
types of files are normal Word and Excel files which will either be located
on my local drive or a netwrok drive.
It's basically the normal Hyperlink button you get in any MS application,
but I just want it within a form and for the link to be copied into column H5
onwards.
Please let me know if you can help me?
"Dave Peterson" wrote:
Rightclick on the worksheet tab that has the hyperlinks, then select view code.
Paste this in:
Option Explicit
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
With Target.Parent
.Hyperlinks.Delete
.ClearContents '??? clear the cell, too???
End With
End Sub
Or maybe...
Option Explicit
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
With Target.Parent
If Intersect(.Cells, Me.Range("e7:h17")) Is Nothing Then
'do nothing
Else
.Hyperlinks.Delete
.ClearContents '??? clear the cell, too???
End If
End With
End Sub
If you want to limit the range.
twinklejmj wrote:
Hi
I desperately look for a macro to remove/ delete the hyperlinks which
are already clicked by the users from a set of hyperlinks, the moment
it is clicked. I have a set of hyperlinks in a column, which I set blue
in color.
Please help!!
Thanks a lot
Twinkle
--
twinklejmj
------------------------------------------------------------------------
twinklejmj's Profile: http://www.excelforum.com/member.php...o&userid=27085
View this thread: http://www.excelforum.com/showthread...hreadid=466303
--
Dave Peterson
--
Dave Peterson