hyperlink address

mfahadakbar

New Member
Joined
Jun 4, 2018
Messages
6
Hi guys,

i want to extract hyperlink text from the friendly names that i have

when i use range.hyperlinks(1).address property it only gives my first 40 characters of the hyperlink

I am actually trying to extract last 7 characters from the hyperlink , but since it is not reading more than 40 characters , its not picking up the right text

Any idea why it is so and how do i get the complete hyperlink string ?

Thanks
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Maybe use range.hyperlinks(1).name

This code (amended but not written by me) picks up more than 40 characters

Code:
Function HLink(rng As Range) As String
'extract URL from hyperlink - posted by Rick Rothstein
  If rng(1).Hyperlinks.Count Then
      HLink = rng.Hyperlinks(1).Name
  End If
End Function
 
Last edited:
Upvote 0
Thank you,

but i figured its not the length of the url , its about a character in the URL , which is '#' . Where ever this shows up, excel will stop reading url further .
This is where i am stuck
 
Upvote 0
The part after the '#' is in the hyperlink's SubAddress property.
Code:
    Dim link As Hyperlink
    Set link = Range("A2").Hyperlinks(1)
    MsgBox link.Address & "#" & link.SubAddress
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,688
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top