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
| Option Explicit
Dim lettre1, lettre2, lettre3, jour, jour2, mois, mois2, annee As Integer
Dim my_file 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
Call coller
Else
jour = jour + 1
jour2 = Format(jour, "00")
mois2 = Format(mois, "00")
my_file = mois2 & "-" & jour2 & "-" & annee
' Call colonne
Call coller
End If
Loop
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