basil3legs
Programmer
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:
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.
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.