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
| Function ChargeDatas(Repert as String, NomFic as String, NomOngl as String, LigDebData as Long, ColMax as Long) As Long
Dim LILIG As Long
Dim LICOL As Long
On Error GoTo Err_Execute
ChargeDatas = -1
Application.CutCopyMode = False
Workbooks.OpenText Filename:=Repert & NomFic, _
Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= xlNone, ConsecutiveDelimiter:=False, _
Tab:=False, Semicolon:=True, Comma:=False, Space:=False, Other:=False, DecimalSeparator:=",", TrailingMinusNumbers:=True
LILIG = 0
If ColMax = 0 Then ColMax = 255
Do While Not IsEmpty(Cells(LILIG + 1, 1))
For LICOL = 1 To ColMax
Workbooks(NomXls).Sheets(NomOngl).Cells(LILIG + LigDebData, LICOL) = Cells(LILIG + 1, LICOL)
Next
LILIG = LILIG + 1
Loop
Workbooks(NomFic).Close SaveChanges:=False
ChargeDatas = LILIG
Exit Function
Err_Execute:
Call ModuleCommun.WriLog("A", "===> Erreur Chargement données : " & Err.Number & " : " & Err.Description)
End Function |
Partager