Visual Basic - Exportar datos a excel

Life is soft - evento anual de software empresarial
 
Vista:

Exportar datos a excel

Publicado por LG (2 intervenciones) el 21/10/2004 22:23:07
Necesito saber como exportar datos de visual a excel
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:Exportar datos a excel

Publicado por miguel (1042 intervenciones) el 21/10/2004 23:50:17
'Debes de Activar la Referencia
'Microsoft Excel 9.0 Object Library
Private Sub Command2_Click()
Dim ApExcel As Excel.Application
Set ApExcel = CreateObject("Excel.application")

ApExcel.Workbooks.Add 'Agrega un Libro
With ApExcel
.Cells(1, 1) = "Prueba" 'Pasar los Datos a Excel
.Cells(1, 2) = "Prueba2"
.Cells(2, 1) = "Prueba3"
.Cells(2, 2) = "Prueba4"
.Range("A1:B10").Font.Color = vbRed 'Color de Letra
.Range("A1:B10").HorizontalAlignment = xlHAlignCenter 'Centrado Hor.
.Range("A1:B10").VerticalAlignment = xlHAlignCenter 'Centrado Vert.
.Range("A1:B10").Font.Name = "Tahoma" 'Nombre Letra
.Range("A1:B10").Font.Size = 11 'Tamaño
.Range("A1:B10").Font.Bold = True 'Negrita
.Range("A1:B10").Font.Italic = True 'Cursiva
.Range("A1:B10").Interior.Color = vbYellow 'Color de Relleno
End With

ApExcel.AlertBeforeOverwriting = False
ApExcel.ActiveWorkbook.SaveAs "Prueba.xls"
ApExcel.Visible = True

Set ApExcel = Nothing

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