Cide
asked on
Calling a subroutine by clicking a link in a textbox.
Hello all,
I need to know how to create a hyperlink in a textbox (or richtextbox) that when clicked DOES NOT open a browser window, I would like it to call a subroutine instead with the clicked text as a parameter instead.
I also don't want the whole box clickable, or to call the routine, just a specfic word in the box.
For instance if the textbox contained, "Hello my name is Joe.", when the user clicks on Joe (which should be underlined and blue to look like a hyperlink) a subroutine would be called and "Joe" would be stored in the variable. BUT, clicking on any other word would do nothing.
Thanks for any help or suggestions in Advance,
Aaron
I need to know how to create a hyperlink in a textbox (or richtextbox) that when clicked DOES NOT open a browser window, I would like it to call a subroutine instead with the clicked text as a parameter instead.
I also don't want the whole box clickable, or to call the routine, just a specfic word in the box.
For instance if the textbox contained, "Hello my name is Joe.", when the user clicks on Joe (which should be underlined and blue to look like a hyperlink) a subroutine would be called and "Joe" would be stored in the variable. BUT, clicking on any other word would do nothing.
Thanks for any help or suggestions in Advance,
Aaron
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I love it! Good work! :)
Aaron
Aaron
Put a Multiline TextBox with scrollBars and write this code:
Private Sub Text1_DblClick()
If Text1.SelText <> "" Then myPro (Text1.SelText)
End Sub
Sub myProc(t As String)
MsgBox t
'your code goes here
End Sub
Hope this helps!
-priya