![]() |
excel macro problem
Probably the best way around this is to add
Option Explicit At the beginning of the module. This is going to require you to explicitly declare all variables. When you have done this Click on Debug - Compile. Fix the errors as the compiler finds them. I do not guarantee that this will fix the problem (but it rules out one of the most likely suspects). HTH "yvaurin" wrote: Hi everybody! I am trying to make a macro in excel to import automatically all the text files within a folder to xls files. So, I wrote a macro, in personal.xla When Ilaunch the macro, I get a "error 400"... Here is my macro : Sub yann3() ' ' yann3 Macro ' Macro enregistrée le 12/04/05 par yann_vautrin ' ' Dim cpt As Integer ' ouvre tous les fichiers contenus dans un dossier chemin = InputBox("Entrez le chemin du dossier contenant les fichiers") 'on se met dans le repertoire ChDir chemin ' on prend le premier fichier du repertoire Fichier = Dir(chemin) 'parcours des fichiers While Fichier < "" Workbooks.OpenText Fichier, Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, _ Comma:=True, 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), Array(9, 1)), TrailingMinusNumbers:=True ActiveWorkbook.SaveAs Filename:=Fichier, FileFormat:=xlNormal, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False ActiveWorkbook.Close Wend End Sub Thanks for your help. Yann |
All times are GMT +1. The time now is 12:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com