Ver Mensaje Individual
  #5 (permalink)  
Antiguo 28/01/2008, 10:44
Avatar de abrahamvj
abrahamvj
 
Fecha de Ingreso: julio-2006
Ubicación: Lima, Peru
Mensajes: 708
Antigüedad: 17 años, 9 meses
Puntos: 18
Re: excel + macros

Les dejo un ejemplo de como insertar una imagen sobre un rango y ademas dandole un nombre determinado a esa imagen:

Sub fotoinsertada()
Dim foto As Object, Arriba As Double, Izquierda As Double, Ancho As Double, Alto As Double
Dim ruta As String
Application.ScreenUpdating = False
On Error Resume Next
If Not Target = [a1] Then Exit Sub
Hoja1.Shapes("Foto").Delete
ruta = "C:\Documents and Settings\AVALENCIA\Mis documentos\Mis imágenes\cumplesatan.bmp"
Set foto = Hoja1.Pictures.Insert(ruta)
With Range("c1:d8")
Arriba = .Top
Izquierda = .Left
Ancho = .Offset(0, .Columns.Count).Left - .Left
Alto = .Offset(.Rows.Count, 0).Top - .Top
End With
With foto
.Name = "Foto"
.Top = Arriba
.Left = Izquierda
.Width = Ancho
.Height = Alto
End With
Set foto = Nothing
Application.ScreenUpdating = True
End Sub

Abraham