Resources

    All about Visual Basic for Application (VBA) especially for Microsoft Excel.

Subscribe

  • Subscribe

How to get Text to Display and Also link address via VBA?

Posted by | January 25, 2013 .

In Microsoft Excel when have hyperlink normally the text in cell become blue and when we move our cursor on top, it will display the link address which is hidden inside. Therefore some time necessary to get Text to Display and also the hyperlink
address via code or Visual Basic for Applications. Below example will do the job for you. Please try by inserting this code into module, run and feedback to me the result, please don’t forget to put hyperlink into cell A1.

Option Explicit

Sub GetHyperlinkAndText()
Dim GetText As String
Dim GetAddress As String
On Error GoTo line1
GetText = Range("A1").Hyperlinks(1).TextToDisplay
GetAddress = Range("A1").Hyperlinks(1).Address
MsgBox "Your anchor Text = " & GetText & Chr(10) & "Your link = " & GetAddress
End
line1:
MsgBox "Sorry! Link not found."
End Sub

If you have any question or project please e-mail to me, I will reply and create

for free depending on my free time.
Click Here to E-mail
Or
Click here to get your project done with 5 Dollar
Thanks

Related Articles to insert code into Module:
Learn To Record And Playback Macro
Get To Know VBE (Visual Basic Editor)

Share Button
Share on Facebook
Bookmark this on Digg
Bookmark this on Yahoo Bookmark
Bookmark this on Google Bookmarks
Bookmark this on Delicious

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments