reading the hyperlink

N

Neil Jarman

Hi,

I have a column of hyperlinked cells, and I need to read the value of the
hyperlink in order to process it.

eg: say I needed to get the last 10 chars from the hyperlink in Ax and put
it in Cx,
I want to write some code like this

Private Sub CommandButton1_Click()

Dim iMaxRow
iMaxRow = 5 ' 648

For iIndex = 1 To iMaxRow
Worksheets("Sheet1").Cells(iIndex, 3).Value =
Right$(Worksheets("Sheet1").Cells(iIndex, 1).Hyperlink.Address, 10)
Next iIndex

End Sub

Obviously this doesn't work, or I wouldn't be asking...

Any advice really appreciated. Found this group after searchng MS.com.

Cheers,

NEIL
 
A

Alvin Bruney [MVP - ASP.NET]

what does this print out to the screen?
Worksheets("Sheet1").Cells(iIndex, 1).Hyperlink.Address

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
 
N

Neil Jarman

I get "Object doesn't support the property or method"

NEIL



Alvin Bruney said:
what does this print out to the screen?
Worksheets("Sheet1").Cells(iIndex, 1).Hyperlink.Address

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Neil Jarman said:
Hi,

I have a column of hyperlinked cells, and I need to read the value of the
hyperlink in order to process it.

eg: say I needed to get the last 10 chars from the hyperlink in Ax and put
it in Cx,
I want to write some code like this

Private Sub CommandButton1_Click()

Dim iMaxRow
iMaxRow = 5 ' 648

For iIndex = 1 To iMaxRow
Worksheets("Sheet1").Cells(iIndex, 3).Value =
Right$(Worksheets("Sheet1").Cells(iIndex, 1).Hyperlink.Address, 10)
Next iIndex

End Sub

Obviously this doesn't work, or I wouldn't be asking...

Any advice really appreciated. Found this group after searchng MS.com.

Cheers,

NEIL
 
A

Alvin Bruney [MVP - ASP.NET]

This should work for you. Code extracted from the black book
Code-listing 6.9 sample code to show hyperlinks




Javascript




Function InsertLink(string hyperlink)

{

//find a suitable range

var Hyperlink = Spreadsheet1.Worksheets("sheet1").Range("A1")

Hyperlink.Value = "MSDN Links"

Hyperlink.Hyperlink.Address = "http://msdn.microsoft.com"

}





--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Neil Jarman said:
I get "Object doesn't support the property or method"

NEIL



Alvin Bruney said:
what does this print out to the screen?
Worksheets("Sheet1").Cells(iIndex, 1).Hyperlink.Address

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Neil Jarman said:
Hi,

I have a column of hyperlinked cells, and I need to read the value of the
hyperlink in order to process it.

eg: say I needed to get the last 10 chars from the hyperlink in Ax and put
it in Cx,
I want to write some code like this

Private Sub CommandButton1_Click()

Dim iMaxRow
iMaxRow = 5 ' 648

For iIndex = 1 To iMaxRow
Worksheets("Sheet1").Cells(iIndex, 3).Value =
Right$(Worksheets("Sheet1").Cells(iIndex, 1).Hyperlink.Address, 10)
Next iIndex

End Sub

Obviously this doesn't work, or I wouldn't be asking...

Any advice really appreciated. Found this group after searchng MS.com.

Cheers,

NEIL
 

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

Top