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 27 28 29 30 31
| Dim App As Object
Dim maxligne, numligne, onligne As Long
Dim i As Integer
Dim popol As String
On Error GoTo Err_Extract_value
Application.Screen.MousePointer = 11
Set App = CreateObject("Excel.application")
App.Workbooks.Open "C:\Documents and Settings\Essais_extract.xlt" ,, False
strSQL = "select RFW_Tab.RFW_ref, RFW_Tab.Directorate, RFW_Tab.Groupe, RFW_Tab.RFW_issue, RFW_Tab.Orient_screening, RFW_Tab.DR_committed, RFW_Tab.DR_agreed, RFW_Tab.AL_wished_target, RFW_Tab.MISP_closure_plan, RFW_Tab.MISP_closed, RFW_Tab.Closed_date from RFW_Tab order by RFW_issue;"
Set rst = CurrentDb.OpenRecordset(strSQL)
If Not rst.EOF Then
rst.MoveLast
rst.MoveFirst
maxligne = rst.RecordCount
App.Sheets("Extract_1").Select
With App.Worksheets("Extract_1")
For numligne = 2 To maxligne + 1
For i = 0 To 10
.Cells(numligne, i + 1) = rst(i).Value
Next i
rst.MoveNext
Next numligne
End With
End If
rst.Close
Application.Screen.MousePointer = 0
App.SaveAs "C:\Documents and Settings\Essais_extract.xls" |
Partager