hola a todos, estoy trabajando con ADO para traer datos a excel, como lo que
pongo abajo de la pregunta, eso me funciona bien, y me trae los datos muy
bien y todo, pero resulta que hice lo mismo con MicrosoftQuery y ES MAS
RAPIDO!!!, yo pensé que iba a ser mucho mas rapido con ADO, pero no.
Esto haciendo algo mal en mi procedimiento?, hay otra forma de hacerlo con
ADO (mas rapida)? o definitivamente es mas rapido MicrosoftQuery?
Mil gracias desde ya, aca esta el código
Dim Con1 As ADODB.Connection
Dim Rst1 As ADODB.Recordset
Dim Sql As String
CreaConexiones
Sql = "SELECT * FROM InfVentas_Final"
'setea y abre conexión
Set Con1 = New ADODB.Connection
Con1.ConnectionString = CadenaConexion(6)
Con1.Open
'Ejecuta el comando sql
Set Rst1 = New ADODB.Recordset
Rst1.CursorType = adOpenKeyset
Rst1.LockType = adLockOptimistic
Rst1.Open Sql, Con1
If Rst1.EOF Then
MsgBox "NO HAY REGISTROS"
Else
Sheets("Ventas 2004").Select
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.ClearContents
Range("A2").Select
Do While Not Rst1.EOF
ActiveCell.Offset(0, 0) = Rst1!NumOrd
ActiveCell.Offset(0, 1) = Rst1!FecOrd
ActiveCell.Offset(0, 2) = Rst1!Titulo
ActiveCell.Offset(1, 0).Select
Rst1.MoveNext
Loop
End If
Range("A2").Select
'Cierra variable
Set Cmd1 = Nothing
Con1.Close
Set Con1 = Nothing
Leer las respuestas