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 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| ''''''''''''''''''' Overture
Dim fichier As String = OpenFileDialog1.FileName.ToString
xlap = New Excel.Application
cl = xlap.Workbooks.Open(fichier)
fl = cl.ActiveSheet
Try
Dim tab(fl.UsedRange.Rows.Count) As STRUCTURE_T
u = 0
'If fl.UsedRange.Rows.Count > 500 Then
' Progressement.ProgressBar1.Maximum = 160
' 'Progressement.MdiParent = Controle
' Progressement.ShowDialog()
'Else
' Progressement.ProgressBar1.Maximum = 60
' 'Progressement.MdiParent = Controle
' Progressement.ShowDialog()
'End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''' Partie Lecteur
Progressement.ShowDialog()
For i As Integer = 2 To fl.UsedRange.Rows.Count
tab(u).Date_integration = date_int.ToString
tab(u).FICHIER = fl.UsedRange.Cells(i, 12).text.ToString.Substring(0, 6)
tab(u).Num_CLI = fl.UsedRange.Cells(i, 1).text.ToString
tab(u).CIVILITE = civT(fl.UsedRange.Cells(i, 2).text.ToString)
tab(u).Nom = fl.UsedRange.Cells(i, 3).text.ToString
tab(u).PRENOM = fl.UsedRange.Cells(i, 4).text.ToString
tab(u).Ville = fl.UsedRange.Cells(i, 5).text.ToString
tab(u).Id_Pays = fl.UsedRange.Cells(i, 6).text.ToString
tab(u).tel1 = CBTEL1_FR(fl.UsedRange.Cells(i, 7).text.ToString).ToString
tab(u).tel2 = CBTEL2_FR(fl.UsedRange.Cells(i, 7).text.ToString).ToString
tab(u).DATE_ANC_CMD = fl.UsedRange.Cells(i, 8).text.ToString
tab(u).REF_COMMANDE = fl.UsedRange.Cells(i, 9).text.ToString
tab(u).TOTAL_ANC_CMD = fl.UsedRange.Cells(i, 10).text.ToString
tab(u).Code_Rejet = fl.UsedRange.Cells(i, 11).text.ToString
tab(u).DETAIL_CODE = dtailcode(fl.UsedRange.Cells(i, 11).text.ToString).ToString
tab(u).CODE_OPE = fl.UsedRange.Cells(i, 12).text.ToString
tab(u).COMMAND1 = fl.UsedRange.Cells(i, 13).text.ToString
tab(u).COMMAND2 = fl.UsedRange.Cells(i, 14).text.ToString
tab(u).COMMAND3 = fl.UsedRange.Cells(i, 15).text.ToString
tab(u).COMMAND4 = fl.UsedRange.Cells(i, 16).text.ToString
tab(u).COMMAND5 = fl.UsedRange.Cells(i, 17).text.ToString
tab(u).COMMAND6 = fl.UsedRange.Cells(i, 18).text.ToString
tab(u).Mode_Moyen_Reg = fl.UsedRange.Cells(i, 37).text.ToString
tab(u).MODE_PAIE = modemr(fl.UsedRange.Cells(i, 37).text.ToString)
Progressement.ProgressBar1.Value = CInt(i / fl.UsedRange.Rows.Count)
Label1.Text = i
u += 1
Next
cl.Close()
xlap.Quit()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''' Partie Ecriteur
xlap2 = New Excel.Application
cl2 = xlap2.Workbooks.Add
fl2 = cl2.Sheets(1)
fl2.Cells(1, 1).value = "DATE_INTEGRATION"
fl2.Cells(1, 2).value = "FICHIER"
fl2.Cells(1, 3).value = "Num_CLI"
fl2.Cells(1, 4).value = "CIVILITE"
fl2.Cells(1, 5).value = "Nom"
fl2.Cells(1, 6).value = "PRENOM"
fl2.Cells(1, 7).value = "Ville"
fl2.Cells(1, 8).value = "Id_Pays"
fl2.Cells(1, 9).value = "TEL"
fl2.Cells(1, 10).value = "TEL2"
fl2.Cells(1, 11).value = "DATE_ANC_CMD"
fl2.Cells(1, 12).value = "REF_COMMANDE"
fl2.Cells(1, 13).value = "TOTAL_ANC_CMD"
fl2.Cells(1, 14).value = "Code_Rejet"
fl2.Cells(1, 15).value = "DETAIL_CODE"
fl2.Cells(1, 16).value = "CODE_OPE"
fl2.Cells(1, 17).value = "COMMAND1"
fl2.Cells(1, 18).value = "COMMAND2"
fl2.Cells(1, 19).value = "COMMAND3"
fl2.Cells(1, 20).value = "COMMAND4"
fl2.Cells(1, 21).value = "COMMAND5"
fl2.Cells(1, 22).value = "COMMAND6"
fl2.Cells(1, 23).value = "Mode_Moyen_Reg"
fl2.Cells(1, 24).value = "MODE_PAIE"
For j As Integer = 0 To UBound(tab)
For c As Integer = 1 To 24
fl2.Cells(j + 2, c).NumberFormat = "@"
fl2.Cells(j + 2, 1) = tab(j).Date_integration
fl2.Cells(j + 2, 2) = tab(j).FICHIER
fl2.Cells(j + 2, 3) = tab(j).Num_CLI
fl2.Cells(j + 2, 4) = tab(j).CIVILITE
fl2.Cells(j + 2, 5) = tab(j).Nom
fl2.Cells(j + 2, 6) = tab(j).PRENOM
fl2.Cells(j + 2, 7) = tab(j).Ville
fl2.Cells(j + 2, 8) = tab(j).Id_Pays
fl2.Cells(j + 2, 9) = tab(j).tel1
fl2.Cells(j + 2, 10) = tab(j).tel2
fl2.Cells(j + 2, 11) = tab(j).DATE_ANC_CMD
fl2.Cells(j + 2, 12) = tab(j).REF_COMMANDE
fl2.Cells(j + 2, 13) = tab(j).TOTAL_ANC_CMD
fl2.Cells(j + 2, 14) = tab(j).Code_Rejet
fl2.Cells(j + 2, 15) = tab(j).DETAIL_CODE
fl2.Cells(j + 2, 16) = tab(j).CODE_OPE
fl2.Cells(j + 2, 17) = tab(j).COMMAND1
fl2.Cells(j + 2, 18) = tab(j).COMMAND2
fl2.Cells(j + 2, 19) = tab(j).COMMAND3
fl2.Cells(j + 2, 20) = tab(j).COMMAND4
fl2.Cells(j + 2, 21) = tab(j).COMMAND5
fl2.Cells(j + 2, 22) = tab(j).COMMAND6
fl2.Cells(j + 2, 23) = tab(j).Mode_Moyen_Reg
fl2.Cells(j + 2, 24) = tab(j).MODE_PAIE
Next
Next
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
fl2.SaveAs(SaveFileDialog1.FileName.ToString)
Dim ovrxl As Excel.Application
Dim ovrcl As Excel.Workbook
Dim ovrsh As Excel.Worksheet
ovrxl = New Excel.Application
ovrcl = ovrxl.Workbooks.Open(SaveFileDialog1.FileName.ToString)
ovrsh = ovrcl.Worksheets(1)
ovrxl.Visible = True
xlap2.Quit()
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Catch ex As Exception
MsgBox(ex.ToString)
End Try
'''''''''''''''''''''' CBR UK
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
Partager