12/04/10 23:11
mastergov
Ciao ragazzi mi potreste dire dove sbaglio ?!? ho un database con tutti i dati e un foglio di excell da riempire tramite un ciclo :
non riesco a capire xchè non mi riempie le celle dove sbaglio!??
Private Sub Command1_Click() Dim descrizione As String Dim articolo As String Dim totale As Double Dim varmese As String Dim totannuo As Double If Combo1.Text = "Tutti" Then stringa = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" stringa = stringa & App.Path & "\resoconto.mdb" Set cn = New ADODB.Connection Set rs = New ADODB.Recordset cn.Open stringa rs.Open "select * from clienti", cn, 3, 3 Set oExcel = CreateObject("Excel.Application") Set oBook = oExcel.Workbooks.Open(App.Path & "\cartel1.xlsx") Set oSheet = oBook.Worksheets(1) Dim r As Integer r = 8 Do With oSheet .Range(1, r).Value = rs("Data").Value .Cells(2, r).Value = rs("cliente").Value .Cells(4, r).Value = rs("articolo").Value .Cells(6, r).Value = rs("totale").Value r = r + 1 rs.MoveNext End With Loop Until rs.EOF = True oBook.SaveAs App.Path & "\cartel1.xlsx" oExcel.Application.Visible = True 'VISUALIZZA FILE EXCEL rs.Close cn.Close Set rs = Nothing Set cn = Nothing End If End Sub
non riesco a capire xchè non mi riempie le celle dove sbaglio!??
aaa