Visual Basic - Error en codigo RURI por favor ayuda

Life is soft - evento anual de software empresarial
 
Vista:

Error en codigo RURI por favor ayuda

Publicado por miguel (50 intervenciones) el 30/10/2004 14:36:34
Hola,

Tengo problemas con un código, estoy tratando de copiar un recordset a excel, pero me sale un error en el código.

Por favor necesito que me ayuden. Gracias

Private Sub mnuGenerarinforme_Click()
Dim Xlapp As Excel.Application
Dim Prueba As Excel.Workbook
Dim Totalreg As Double
Dim Totalcol As Integer

Set Xlapp = Nothing
Set Xlapp = New Excel.Application
Xlapp.Workbooks.Add

Set Prueba = Nothing
Set Prueba = Xlapp.Workbooks(Xlapp.Workbooks.Count)

Set Hoja1 = Nothing
Set Hoja1 = Prueba.Worksheets.Add
With datPrimaryRS.Recordset
.MoveLast
Totalreg = .RecordCount
.MoveFirst
Totalcol = grdDataGrid.Columns.Count

For i = 0 To Totalcol - 1
Hoja1.Cells(1, i + 1).Value = datPrimaryRS.Recordset.Fields(i).Name
Next i

Hoja1.Range("A1").CopyFromRecordset datPrimaryRS.Recordset '<--- Aca es donde me marca el error

Prueba.SaveAs Format(Now(), "ddmmyyyy")

Set Hoja1 = Nothing
Set Prueba = Nothing
Set Xlapp = Nothing
End With
End Sub
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