Caractère séparateur sous excel VBA

Résolu/Fermé
mmmxtina - 23 juin 2009 à 14:50
mmmxtina Messages postés 67 Date d'inscription mardi 26 mai 2009 Statut Membre Dernière intervention 9 avril 2013 - 24 juin 2009 à 09:29
Bonjour tout le monde!!!

J'ai un soucis!
Je dois importer un fichier texte sous excel, mais le problème c'est que mon séparateur c'est ":" et pas ";", donc cu coup c'est mal délimiter.
je vous montre le code:

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & Monchemin _
, Destination:=Range("A1"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlMSDOS
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote 'ça ne fonctionne pas avec les ":"
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.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)
.TextFileFixedColumnWidths = Array(3, 14, 32, 32, 5, 20, 10, 30, 9, 12, 8, 32, 5, 32, 2, 15, 1 _
, 10, 1, 20, 10, 9)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

Une idée? j'ai repris la fonction d'un collègue il me semble qu'il a paramétrer la taille des colonne, m'enfin pas trop compris j'avou.

Merciiiiiiiii à tous d'avance!
A voir également:

2 réponses

yg_be Messages postés 22698 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 18 avril 2024 1 471
23 juin 2009 à 23:58
Et ainsi :
.TextFileParseType = xlDelimited
.TextFileOtherDelimiter = ":"
1
mmmxtina Messages postés 67 Date d'inscription mardi 26 mai 2009 Statut Membre Dernière intervention 9 avril 2013 1
24 juin 2009 à 09:29
merci!!! j'ai testé ça hier ça fonctionne!!
bonne journée!
1