Visual Basic - Exportar a excel datagrid

Life is soft - evento anual de software empresarial
 
Vista:
sin imagen de perfil
Val: 27
Ha aumentado 1 puesto en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

Exportar a excel datagrid

Publicado por Mariano (51 intervenciones) el 08/06/2018 17:34:27
hola tengo este codigo en VB6.0 con base de datos acces me da error
el error lo tengo en la linea que tiene la cara
osea me lo exporta pero me obliga a cerrar el sistema

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Dim i As Integer, j As Integer, icol As Integer
If nfilas = 1 Then
MsgBox "Nohay datos que enviar a Excel": Exit Sub
Else
Set objExcel = CreateObject("Excel.application")
Set xlibro = objExcel.Workbooks.Add(App.Path & "\ProductosSalida.xls")
objExcel.Visible = True
Set hoja = objExcel.ActiveSheet
 
icol = 0
For i = 1 To datagrid.Columns.Count - 1
    If datagrid.Columns(i).Visible Then
        icol = icol + 1
        hoja.Cells(1, icol) = datagrid.Columns(i).Caption
    For j = 0 To nfilas - 1
    ='/img/emoticons/omg.gif' width='22' height='22' border='0' />    hoja.Cells(j + 2, icol) = datagrid.Columns(i).CellValue(datagrid.GetBookmark(j))
    Next
    End If
Next
hoja.Rows(1).Font.Bold = True
hoja.Rows(1).Font.Color = vbBlack
hoja.Columns("A:Z").AutoFit
End If
Set hoja = Nothing
Set xlibro = Nothing
Set objExcel = Nothing

Desde ya gracias
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