View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default How do I extract and save hyperlinks from images in excel

Robert in Brisbane wrote:
I have a spreadsheet with many lines of data, and each line has an image with
a hyperlink embedded.
I want to be able to do a general copy and paste of JUST the hyperlink
information, into another column, but cannot seem to work out if it can be
done.

Any help would be appreciated.
Thanks


Program version: MS Excel 2002 SP3


Hi Robert,

Try this macro...

Public Sub HyperlinkNames()
Dim Shp As Shape
Dim rngDestination As Range

Set rngDestination = Application.InputBox( _
Prompt:="Select any cell in the column " & _
"to receive the hyperlink names.", _
Title:="Destination Column", _
Default:=Selection.Address, _
Type:=8)

For Each Shp In ActiveSheet.Shapes
If Shp.Type = 13 Then
On Error Resume Next
Cells(Shp.TopLeftCell.Row, _
rngDestination.Column).Value = _
Shp.Hyperlink.Name
End If
Next Shp
End Sub

If the images are Pictures, rather than drawing objects, then for every
Picture on the sheet that has a hyperlink, the macro will put the
hyperlink's name into the cell that is on the same row as the Picture
and in the column that you have chosen.
It should work OK provided the sheet does not have more than one
Picture per row.

Ken Johnson