| 12
 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
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 
 |  
 
Option Compare Database
Option Explicit
Private Sub Commande0_Click()
 
    Dim xlBook As Excel.Workbook
    Dim xlApp As Excel.Application
    Dim xlSheet As Excel.Worksheet
    Dim rs As Recordset
    Dim r As Long
    Dim DernLigne As Long
 
  On Error Resume Next
 
    Set xlApp = CreateObject("Excel.Application")
    Set xlBook = xlApp.Workbooks.Open("C:\Documents and Settings\mbenamiar\Mes documents\Téléchargements\Extract_BSC_RES.xls")
    Set xlSheet = xlBook.Worksheets("Extract_BSC_RES")
    xlSheet.Activate
 
                Set rs = CurrentDb.OpenRecordset("BSC")
                DernLigne = xlSheet.Range("A" & xlSheet.Rows.Count).End(xlUp).Row
                r = 2
                If dateCreation.Value <> "" Then
              For r = 2 To 100
                        With rs
            .AddNew
            .Fields("ID Incident") = xlSheet.Cells(r, 1).Value
            .Fields("IN - Incident Type") = xlSheet.Cells(r, 2).Value
            .Fields("IN - Status") = xlSheet.Cells(r, 3).Value
            .Fields("IN - Affected CI") = xlSheet.Cells(r, 4).Value
            .Fields("IN - CI Name") = xlSheet.Cells(r, 5).Value
            .Fields("IN - Environment") = xlSheet.Cells(r, 6).Value
            .Fields("IN - Title") = xlSheet.Cells(r, 7).Value
            .Fields("IN - Incident Description") = xlSheet.Cells(r, 8).Value
            .Fields("IN - Open by group") = xlSheet.Cells(r, 9).Value
            .Fields("IN - Opened By") = xlSheet.Cells(r, 10).Value
            .Fields("IN - Open Time") = xlSheet.Cells(r, 11).Value
            .Fields("IN - Restored By Group") = xlSheet.Cells(r, 12).Value
            .Fields("IN - Restored Time") = xlSheet.Cells(r, 13).Value
            .Fields("IN - Impact") = xlSheet.Cells(r, 14).Value
            .Fields("IN - Urgency") = xlSheet.Cells(r, 15).Value
            .Fields("IN - Priority") = xlSheet.Cells(r, 16).Value
            .Fields("IN - BSC - Date de livraison estimée") = xlSheet.Cells(r, 17).Value
            .Fields("IN - Outage Start") = xlSheet.Cells(r, 18).Value
            .Fields("IN - Outage End") = xlSheet.Cells(r, 19).Value
            .Fields("IN - Requested Start Date") = xlSheet.Cells(r, 20).Value
            .Fields("IN - Requested End Date") = xlSheet.Cells(r, 21).Value
             .Fields("IN - Implementation Date") = xlSheet.Cells(r, 22).Value
            .Fields("IN - Characterisation") = xlSheet.Cells(r, 23).Value
            .Fields("IN - Imputation") = xlSheet.Cells(r, 24).Value
            .Fields("IN - Category") = xlSheet.Cells(r, 25).Value
             .Fields("IN - Sub-Category") = xlSheet.Cells(r, 26).Value
            .Fields("IN - Itsm App Name") = xlSheet.Cells(r, 27).Value
            .Fields("IN - Category Legacy") = xlSheet.Cells(r, 28).Value
            .Fields("IN - Reference Number") = xlSheet.Cells(r, 29).Value
             .Fields("IN - Closure Code") = xlSheet.Cells(r, 30).Value
            .Fields("IN - W U Category") = xlSheet.Cells(r, 31).Value
            .Fields("IN - BSC - UO estimée") = xlSheet.Cells(r, 32).Value
            .Fields("IN - BSC - UO réelle") = xlSheet.Cells(r, 33).Value
            .Fields("IN - Update Action") = xlSheet.Cells(r, 34).Value
            .Fields("IN - Update Time") = xlSheet.Cells(r, 35).Value
            .Fields("IN - Solution") = xlSheet.Cells(r, 36).Value
            .Fields("IN - BSC - Real Delivery Date") = xlSheet.Cells(r, 37).Value
            .Fields("IN - BSC - Estimate Validated") = xlSheet.Cells(r, 38).Value
            .Fields("IN - Assignee Name") = xlSheet.Cells(r, 39).Value
            .Fields("IN - Assignee Group") = xlSheet.Cells(r, 40).Value
            .Fields("IN - Clock Name") = xlSheet.Cells(r, 41).Value
            .Fields("IN - Running") = xlSheet.Cells(r, 42).Value
            .Fields("IN - Schedule") = xlSheet.Cells(r, 43).Value
            .Fields("IN - Closed total MM") = xlSheet.Cells(r, 44).Value
            .Fields("Mesures") = xlSheet.Cells(r, 45).Value
            .Fields("IN - Delay between outage start and open time") = xlSheet.Cells(r, 46).Value
            .Fields("IN - BSC - Respect of the delivery date ( Statut)") = xlSheet.Cells(r, 47).Value
            .Fields("IN - Delivery date of an estimate") = xlSheet.Cells(r, 48).Value
            .Fields("DATE_CREATION") = dateCreation.Value
            .Update
        End With
             Next r
               MsgBox "Importation terminée avec succès", vbOKOnly + vbInformation, "Message d'information"
             Else
             MsgBox "Veuillez introduire une date", vbOKOnly + vbExclamation, "Message"
             End If
    rs.Close
    Set rs = Nothing
     'loadimage.Visible = False
     Set xlSheet = Nothing
    Set xlBook = Nothing
       Set xlApp = Nothing
    xlApp.Quit
 
End Sub | 
Partager