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
| Option Explicit
Dim lettre1, lettre2, lettre3, jour, jour2, mois, mois2, annee As Integer
Dim my_file, sFichier As String
Public Sub main()
jour = 0
mois = 5
annee = 2011
lettre1 = ""
lettre2 = ""
lettre3 = 55
Do While my_file <> "05-31-2011"
If (jour = 31) Then
jour = 1
mois = mois + 1
jour2 = Format(jour, "00")
mois2 = Format(mois, "00")
my_file = mois2 & "-" & jour2 & "-" & annee
' Call colonne
If ExistenceFichier("\\10.57.70.210\Production\Secondaire\" & my_file & ".his") Then
Call coller
Else
End If
Else
jour = jour + 1
jour2 = Format(jour, "00")
mois2 = Format(mois, "00")
my_file = mois2 & "-" & jour2 & "-" & annee
' Call colonne
If ExistenceFichier("\\10.57.70.210\Production\Secondaire\" & my_file & ".his") Then
Call coller
Else
End If
End If
Loop
End Sub
'Public Sub colonne()
'
' If (lettre2 = "" And lettre3 > 90) Then
'
' lettre2 = 64
'
' End If
'
' If (lettre3 > 90) Then
'
' lettre3 = lettre3 - 26
' lettre2 = lettre2 + 1
'
' Else
'
' lettre3 = lettre3 + 10
' End If
'
'End Sub
Public Sub coller()
Range("A3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;\\10.57.70.210\Production\Secondaire\" & my_file & ".his", Destination:= _
Range("$A$3"))
.Name = my_file
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub |
Partager