Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Hyperlinks from Pictures in Excel

Status
Not open for further replies.

basil3legs

Programmer
Jun 13, 2002
157
GB
Hi,

I have a spreadsheet where I cut and paste a web-page to one of the pages and then strip data from it using VBA (the webpage won't let me import it using a web-query). On this page there are numerous pictures with hyperlinks attached. How can I get the hyperlinks from these pictures? Ideally I want to read the hyperlinks with reference to the cell each picture is in as it relates to other data on that row, however I can work around this if necessary. Also, not all the pictures have a hyperlink, however all the ones that do use the same gif image (and every time this image is used it has a hyperlink).

I have tried things along the lines of:

Code:
Count = 1
Sheets("Webpage").Select
For Each pic In ActiveSheet.Shapes
    On Error Resume Next
    Worksheets("Webpage").Cells(Count, 8).Value = pic.Hyperlinks(1).Address
    Count = Count + 1
    Err.Clear
    On Error GoTo 0
Next pic

but nothing I have tried seems to work. I have also tried recording a Macro and doing it manually to see what it records but it only records the selecting of the picture and then the selecting of the cell to write the link to and nothing in between!!

Thanks in advance for any help with this.
 
OK, ignore this question, I have sussed it!!

It should be
Code:
pic.Hyperlink.Address
and then it works fine!!

 
And what about pic.Hyperlink.Address ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top