Hi all,
Thank you for taking the time to view my question.
I am looking for a way to attach the hyperlink which i have in my clipboard to an image i add with this code.
Is there any one who can help me out with the last part?
thanks!
Thank you for taking the time to view my question.
I am looking for a way to attach the hyperlink which i have in my clipboard to an image i add with this code.
Is there any one who can help me out with the last part?
thanks!
Code:
Private Sub InsertWord_Click()
Dim clipboardData As New DataObject 'get the info from clipboard
Dim clipboardContents As String 'get the info from clipboard
clipboardData.GetFromClipboard 'get the info from clipboard
clipboardContents = clipboardData.GetText 'get the info from clipboard
Dim clLeft As Double 'select the active cell
Dim clTop As Double 'select the active cell
Dim sFile As String 'select the picture to be added
sFile = "C:\Insert Icons\Word.png"
If Dir(sFile) = "" Then
MsgBox "Picture file was not found in path!", , "No such animal"
Exit Sub
End If
Set cl = Range(Selection.Address) 'set active cell
clLeft = cl.Left
clTop = cl.Top
ActiveSheet.Shapes.AddPicture Filename:=sFile, _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoCTrue, _
Left:=clLeft, Top:=clTop, _
Width:=12, _
Height:=12
End Sub