Sub Poner_Imagen_Fotogra(Direc_Foto, Codigo, Fila)
Dim File_JPG As String, File_Alto As Single, File As String, _
File_PNG As String, File_Anch As Single
Dim Celda_Alto As Single, Celda_Anch As Single, Porcen As Single, _
Celda_Supe As Single, Celda_Izqu As Single, a As Byte
Dim Ini As Single, _
Fin As Single
Application.StatusBar = "Coloca imagen 1 del articulo " & Codigo
' </> ---&--- Seleccion de la imagen
File_JPG = Direc_Foto & Codigo & ".jpg"
File_PNG = Direc_Foto & Codigo & ".png": File = ""
If Dir(File_JPG) <> "" Then File = File_JPG
If Dir(File_PNG) <> "" Then File = File_PNG
' </> ---&--- Posicion de la imagen
If File <> "" Then
Ini = Fila + 0: Celda_Supe = Cells(Ini, 1).Top + 3
Fin = Fila + 5: Celda_Izqu = Cells(Ini, 1).Left + 3
Celda_Anch = Cells(Ini, 1).Width - 8
Celda_Alto = 0
For a = 0 To 5
Celda_Alto = Celda_Alto + Cells(Fila + a, 1).Height
Next
Celda_Alto = Celda_Alto - 6
ActiveSheet.Pictures.Insert(File).Select
With Selection.ShapeRange
File_Alto = .Height
File_Anch = .Width
If File_Alto > File_Anch Then '-----------------------------------
Porcen = File_Alto / File_Anch
.Height = Celda_Alto
.Width = Celda_Alto / Porcen
File_Anch = .Width
.Top = Celda_Supe
.Left = Celda_Izqu + (Celda_Anch - File_Anch) / 2
Else ' -----------------------------------------------------------
Porcen = File_Anch / File_Alto
.Width = Celda_Anch
.Height = Celda_Anch / Porcen
If .Height > Celda_Alto Then
Porcen = File_Alto / File_Anch
.Height = Celda_Alto
.Width = Celda_Alto / Porcen
File_Anch = .Width
.Top = Celda_Supe
.Left = Celda_Izqu + (Celda_Anch - File_Anch) / 2
Else
File_Alto = .Height
.Top = Celda_Supe + (Celda_Alto - File_Alto) / 2
.Left = Celda_Izqu
End If
End If '----------------------------------------------------------
End With
' ---&--- Pongo nombre al objeto: Texto + Código
Selection.ShapeRange.Name = "IMAGEN_A_" & Codigo
End If
End Sub