RE:Una ayuda por favor... para convertir
A ver revisa este ejemplo
Option Explicit
Private Sub cmdMostrar_Click()
Dim ExApp As Application
Dim Cn As Connection
Dim Rs As Recordset
Dim i As Integer
i = 5
Set ExApp = New Application
Set Cn = New Connection
Set Rs = New Recordset
ExApp.Workbooks.Add
ExApp.Range("A1").Value = "Ejemplo de Excel y Visual Basic"
ExApp.Range("A2").Value = "Listado de Productos y Precios"
ExApp.Range("A4").Value = "Producto"
ExApp.Range("B4").Value = "Precio"
Cn.ConnectionString = "Provider=SQLOLEDB;Data Source=Servidor;Initial Catalog=Northwind;User Id=sa"
Cn.Open
Rs.Open "SELECT PRODUCTNAME, UNITPRICE FROM PRODUCTS", Cn, adOpenForwardOnly, adLockReadOnly
Do While Not Rs.EOF
ExApp.Range("A" & i).Value = Rs!ProductName
ExApp.Range("B" & i).Value = Rs!UnitPrice
i = i + 1
Rs.MoveNext
Loop
Rs.Close
Cn.Close
ExApp.ActiveWorkbook.SaveAs "C:\DemoVB.xls", xlNormal
ExApp.Quit
Set ExApp = Nothing
End Sub