Bonsoir à tous,
Voilà, je me lance dans la programmation de macro sous excell via VBA. Dans l'ensemble, c'est pas très compliqué (surtout pour ce que je veux faire) quand on connait un peu de programmation.
Pourtant, j'avoue que j'aimerai comprendre pourquoi la macro suivante (que j'ai récupéré dans une autre macro) marche pour ouvrir un fichier .txt et l'affiche dans excell. Voici les lignes:
(les 4 dernières lignes se sont que des options...)Code:
1
2
3
4
5
6
7
8
9
10 Dim Pfad Pfad = Application.GetOpenFilename(fileFilter:="*,*", MultiSelect:=True) a = 1 Workbooks.OpenText Filename:=Pfad(a), Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _ , Comma:=False, Space:=False, Other:=True, OtherChar:="=", FieldInfo _ :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _ Array(7, 1), Array(8, 1)), TrailingMinusNumbers:=True
Et pourquoi celle-ci ne marche pas:
Ce que je comprends vraiment pas, c'est à quoi sert la variable "a" dans le nom du fichier et pourquoi faut il prévisualiser le fichier.Code:
1
2
3
4
5
6 Application.Dialogs(xlDialogOpenText Filename:= _ "fichier", _ Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _ , Comma:=False, Space:=False, Other:=True, OtherChar:="=", FieldInfo _ :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _ Array(7, 1), Array(8, 1)), TrailingMinusNumbers:=True).Show
Voilà, si vous avez des idées, merci d'avance.
Johann
Configuration: Windows Vista
Firefox 3.0.5