hyperlinktext too long, any remedy?

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

I'm trying to add hyperlink to cells. The following code works
fine only if the sTemp1 is short. If sTemp1 is long (more than 256
letters or something like that), the code won't work.

Is there a remedy? I can set the cell.value to sTemp1 first. But
then how do I add link to the cell?

========================================================
for Each cell In Worksheets("sheet1").Range([b1],
[b65536].End(xlUp)).Cells
..............
..............
If r = 0 Then

cell.Offset(0, 3).Formula = "=HYPERLINK(""" & hyperlinkaddress _
& sTemp & """,""" & sTemp1 & """)"

End If
next
 
John,
I have to ask why on earth you need more than 256 chars.
It is supposed to be the "FriendlyName".

NickHK
 
I have a file full of dictionary entries. Some cells have links to
the dictionary. I managed to delete all the links (probably by
cell.value = string.) Now, I need to recreate the links.

The script I wrote works for short hyperlinktext such as

"to praise highly : GLORIFY"
"over again : ANEW"

but for long text like the following, it won't work.

"2 a : to remove utterly from recognition or memory b : to remove
from existence : destroy utterly all trace, indication, or
significance of c : to cause to disappear (as a bodily part or a
scar) or collapse (as a duct conveying body fluid) : REMOVE 4 <a
blood vessel obliterated by inflammation>"

I have solved the problem. The following command is what I was
looking for.

activesheet.hyperlink.add


John,
I have to ask why on earth you need more than 256 chars.
It is supposed to be the "FriendlyName".

NickHK

I'm trying to add hyperlink to cells. The following code works
fine only if the sTemp1 is short. If sTemp1 is long (more than 256
letters or something like that), the code won't work.

Is there a remedy? I can set the cell.value to sTemp1 first. But
then how do I add link to the cell?

========================================================
for Each cell In Worksheets("sheet1").Range([b1],
[b65536].End(xlUp)).Cells
.............
.............
If r = 0 Then

cell.Offset(0, 3).Formula = "=HYPERLINK(""" & hyperlinkaddress _
& sTemp & """,""" & sTemp1 & """)"

End If
next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top