I have an image in cell “B22” which has been placed there with the following instruction.
numeroFila = tbl.DataBodyRange.Rows.Count
newRow.Range(1, 1).Select
Selection.InsertPictureInCell (fullPath)
You need to take this image, remove it from the cell and copy it to the clipboard and create a file. The objective is to display it in a form. If there is a way to avoid creating the file and place it in the Image object of the form, better
If you change the insertion method using Shapes, you achieve your goal, but the image is not embedded in the cell, which is what you are looking for, and resolution is lost.
With hoja.Shapes.AddPicture(Filename:=fullPath, LinkToFile:=msoFalse, SaveWithDocument:=msoCTrue, Left:=0, Top:=0, Width:=-1, Height:=-1)
.LockAspectRatio = msoTrue
.Left = ActiveCell.Left
.Top = ActiveCell.Top
.Width = ActiveCell.Width
.Height = ActiveCell.Height
nombreFoto = "foto_13"
.Name = nombreFoto
End With
Solutions have been found using the Windows API but they do not work correctly and the complexity of the code increases. Summary: You have an image on the clipboard and you want to place it in an Image object of a form. Thank you