probleme d'importation .txt

irouni

XLDnaute Nouveau
Bonjour tout le monde,

Voici ma premiere discussion et mon premier probleme :


je dois remplacer dans l'adresse d'import une variable alors j'ai fait:

Sub Macro1()
Dim aryan
aryan = Appft\CtiMer\1\logAppliVOCAL\[test22.xls]Feuil1!A1\APPLIVOCAL071217.LOG

' Macro1 Macro
' Macro enregistrée le 19/12/2007
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\aryan\", _
Destination:=Range("A1"))
.Name = "APPLIVOCAL071217"
.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 = True
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileOtherDelimiter = "="
.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)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub

tout ce qui est en bleu c'est moi qui a modifié..
Des lors que je lance la macro il me met en rouge ma variable aryan qui est
aryan = Appft\CtiMer\1\logAppliVOCAL\[test22.xls]Feuil1!A1\APPLIVOCAL071217.LOG et il me dis qu'il y a une erreur de synthaxe la totale ouquoi!!!:confused:
alors je vous demande SVP de m'aider
Cordialement
Irouni
 

wilfried_42

XLDnaute Barbatruc
Re : probleme d'importation .txt

bonjour

je ne suis pas familier des sql, mais je verrai bien cela

Code:
"TEXT;C:\aryan\", _
devient
Code:
"TEXT;C:\" & aryan , _
si aryan est une variable, c'est ce qu'elle contient qui doit etre collé

terminer aryan avec un \ me fait bizarre, ca donnerait en claire :

C:\Appft\CtiMer\1\logAppliVOCAL\[test22.xls]Feuil1!A1\APPLIVOCAL071217.LOG\

@ te lire
 

Discussions similaires

Statistiques des forums

Discussions
312 497
Messages
2 088 992
Membres
104 000
dernier inscrit
dinelcia