Visual Basic - PEGAR IMAGEN EN EXCEL DESDE VB

Life is soft - evento anual de software empresarial
 
Vista:

PEGAR IMAGEN EN EXCEL DESDE VB

Publicado por EMILIO (83 intervenciones) el 25/08/2009 18:33:01
Hola Amigos:

Necesito pegar una imagen en excel desde visual, normalmente utilizo la opcion de crear macro en excel, y luego copio y ajusto el codigo en vb.

Trate de hacer lo mismo, con la opcion: INSERTA IMAGEN en excel, pero no aparece nada en el editor de macros de excel.

Gracias de antemano.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:PEGAR IMAGEN EN EXCEL DESDE VB

Publicado por juan carlos (518 intervenciones) el 26/08/2009 01:57:12
encontre esto en internet, ojala te sirva

Sub V4E()
'
Dim DataPath As String
Dim PicturePath As String

'Import the data
DataPath = "C:Documents and SettingssosalEscritorio emplates" + Hoja1.ComboBox1 + ".dat"
PicturePath = "C:Documents and SettingssosalEscritorio emplates" + Hoja1.ComboBox1 + ".wmf"

'Imports the image
Range("A35").Select
Sheets(1).Pictures.Insert(PicturePath).Select

'Position the image
Sheets(1).DrawingObjects(1).Left = 5
Sheets(1).DrawingObjects(1).Top = 275

'Image is passed in ClipBoard as Exteneded MetaFile
' Width and Height need to be in points (1/72in) so:
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:PEGAR IMAGEN EN EXCEL DESDE VB

Publicado por juan carlos (518 intervenciones) el 26/08/2009 01:59:35
perdon me falto lo siguiente

Sub V4E()
'
Dim DataPath As String
Dim PicturePath As String

'Import the data
DataPath = "C:Documents and SettingssosalEscritorio emplates" + Hoja1.ComboBox1 + ".dat"
PicturePath = "C:Documents and SettingssosalEscritorio emplates" + Hoja1.ComboBox1 + ".wmf"

'Imports the image
Range("A35").Select
Sheets(1).Pictures.Insert(PicturePath).Select

'Position the image
Sheets(1).DrawingObjects(1).Left = 5
Sheets(1).DrawingObjects(1).Top = 275

'Image is passed in ClipBoard as Exteneded MetaFile
' Width and Height need to be in points (1/72in) so:

Selection.ShapeRange.ScaleWidth 1.05, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.22, msoFalse, msoScaleFromTopLeft

End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:PEGAR IMAGEN EN EXCEL DESDE VB

Publicado por EMILIO (83 intervenciones) el 26/08/2009 02:21:32
JUAN CARLOS, muchas gracias, voy a probar este codigo.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar