2
I am creating a table generator in Excel and need to insert several images that are in a certain folder.
I make this insertion by the following code:
altura = 3
On Error Resume Next
For L = 1 To ultimalinha
If Guia.Cells(L, 1).Value <> "" Then
'DEFINE O NOME DA IMAGEM
arquivo_img = Replace(Guia.Cells(L, 2).Value, "/", "")
'INSERE A IMAGEM E DEFINE O NOME
Guia.Pictures.Insert(caminho_img & arquivo_img & ".jpg").Name = arquivo_img
'POSICIONA CORRETAMENTE A IMAGEM E REDIMENSIONA
With Guia.Pictures(arquivo_img)
.ShapeRange.Height = 89
.Top = altura
.Left = (Guia.Columns("A:A").Width) / 2 - .ShapeRange.Width / 2
End With
End If
'Guia.Shapes.Range(Array(arquivo_img)).ShapeRange.Item(1).Hyperlink.Delete
altura = Guia.Cells(L, 1).Height + altura
Next L
I tried to use the method Guia.Shapes.Range(Array(arquivo_img)).ShapeRange.Item(1).Hyperlink.Delete
to break the link of the image but without success.
The code that inserts the image in the spreadsheet I already have, however, I need some procedure or command that makes this image not have any external link, that if I move the folder or even send the spreadsheet by email, the images continue in the spreadsheet.
Possible duplicate of Add photo in excel spreadsheet from local folder
– danieltakeshi
This question is not useful for my problem as this method continues with the external link. But thanks for the suggestion!
– Francisco Salome
You use the
Insert
which leaves an external link, the above link response uses theShapes.AddPicture
that leaves no external link...– danieltakeshi
It worked!! Thank you!
– Francisco Salome