Dim HLK As the Hyperlink, Rng As Range
Dim As Integer I
For I=1 To Sheets. Count
For Each HLK Sheets In (I). Hyperlinks' loop activity worksheet to the hyperlink
If UCase (HLK. Address) Like "*.jpg Or UCase (HLK. Address) Like" *. JPEG Or UCase (HLK. Address) Like "*. PNG" Or UCase (HLK. Address) Like "*. GIF" Then "If the location of the link is JPG Or GIF images (here just for the two types of pictures, more types can be judged through the establishment of an array Or dictionary Or regular)
Set Rng=HLK. Range. Offset (0, 0) 'Set into the position of the target image
With Sheets (I). Pictures. Insert (HLK. Address) 'Insert
the picture linksOn the Error Resume Next
If, Height/Width & gt; Rng. Height/Rng. Width Then 'judgment image aspect ratio and the ratio of cell aspect ratio to determine the proportion of cell zooming
. The Top=Rng. Top
. Left=Rng. Left + (Rng) Width -) Width * Rng in Height/. Height)/2
. Width=. Width * Rng. Height/. Height
. The Height=Rng. Height
The Placement=xlMoveAndSize
//I want to add a hyperlink to the picture, how to write this passage
. Pictures. Insert (HLK. Range. The Value). Select
. Hyperlinks. Add Anchor:=Selection. ShapeRange, Address: Value
=HLK. Range.//I'd like to add a hyperlink to the picture
The Else
. Left=Rng. Left
. Top=Rng. Top + (Rng) Height -) Height * Rng Width/Width)/2
. Height=. Height * Rng. Width/. Width
. Width=Rng. Width
The Placement=xlMoveAndSize
//I want to add a hyperlink to the picture, how to write this passage
. Pictures. Insert (HLK. Range. The Value). Select
. Hyperlinks. Add Anchor:=Selection. ShapeRange, Address: Value
=HLK. Range.//I'd like to add a hyperlink to the picture
End the If
End With
HLK.Range.Valuehttps://bbs.csdn.net/topics/="" 'delete cell image links
End the If
Next
Next I
End Sub
CodePudding user response:
I want to insert images, add a hyperlink to the picture, but this period of how to write the