A
Arnaud5962
Guest
Bonjour,
Je cherche une macro qui me permettrait d'insérer le dernier document téléchargé.
J'ai cela pour l'instant, il me suffit d'associer les duex mais je ny arrive pas.
merci d'avance
Arnaud
Je suis désolé mais je suis novice en macro et je n'arrive pas à associer les deux
Sub Macro9()
'
' Macro9 Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\compta\Mes documents\Téléchargements\Télécharger(2).csv" _
, Destination:=Range("$A$1"))
.Name = "Télécharger(2)"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Dim monrep As String, monfic As String, derdate As Date, ledernier As String
monrep = "C:\Documents and Settings\compta\Mes documents\Téléchargements\"
monfic = Dir(monrep & "*.csv")
derdate = DateSerial(1, 1, 1)
Do While monfic <> ""
If FileDateTime(monrep & monfic) > derdate Then
ledernier = monrep & monfic
derdate = FileDateTime(monrep & monfic)
End If
monfic = Dir
Je cherche une macro qui me permettrait d'insérer le dernier document téléchargé.
J'ai cela pour l'instant, il me suffit d'associer les duex mais je ny arrive pas.
merci d'avance
Arnaud
Je suis désolé mais je suis novice en macro et je n'arrive pas à associer les deux
Sub Macro9()
'
' Macro9 Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\compta\Mes documents\Téléchargements\Télécharger(2).csv" _
, Destination:=Range("$A$1"))
.Name = "Télécharger(2)"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Dim monrep As String, monfic As String, derdate As Date, ledernier As String
monrep = "C:\Documents and Settings\compta\Mes documents\Téléchargements\"
monfic = Dir(monrep & "*.csv")
derdate = DateSerial(1, 1, 1)
Do While monfic <> ""
If FileDateTime(monrep & monfic) > derdate Then
ledernier = monrep & monfic
derdate = FileDateTime(monrep & monfic)
End If
monfic = Dir