Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everybody.
I got a macro to batch process multiple files, this macro works well in Excel 97, but when trying to run it under excel 2003, I got the following error message : "Compile error - Wend without a while" Any Idea? Thanks fr your help Here is the macro : Sub Macro1() ' ' Macro1 Macro ' Macro enregistrée le 18/04/05 par bougeard_gregory ' chemin = InputBox("Entrez le chemin du dossier contenant les fichiers") yann3 (chemin) ' End Sub Sub yann3(chemin As String) ' ' yann3 Macro ' ' Dim cpt As Integer Dim nbFichier As Integer Dim numLigneConcatene As Integer nbFichier = 0 numLigneConcatene = 0 'chemin = InputBox("Entrez le chemin du dossier contenant les fichiers") ChDir chemin Fichier = Dir(chemin) While Fichier < "" Workbooks.OpenText Filename:=Fichier, Origin:=xlWindows, _ StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _ Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array( _ 3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1)) nbFichier = nbFichier + 1 Rows("1:1").Select Selection.Delete Shift:=xlUp Rows("1:1").Select Selection.Delete Shift:=xlUp Rows("1:1").Select Selection.Delete Shift:=xlUp If numLigneConcatene < 0 Then Rows("1:1").Select Selection.Delete Shift:=xlUp End If cpt = 1 Range("G1").Select Do While (ActiveCell.Text < "") Cells(cpt, 8).Value = ActiveWorkbook.Name cpt = cpt + 1 Cells(cpt, 7).Select Loop ActiveWorkbook.Save 'go to next file Fichier = Dir Wend 'merge data into a single file Shell ("command.com /C copy " + chemin + "*.txt" + chemin + "monfichier.txt") End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 Macro Help (Excel 2003 not working in 2007) | Excel Discussion (Misc queries) | |||
Excel 2000 macro not working in Excel 2003 | Excel Discussion (Misc queries) | |||
excel 2003 slow when working with excel 2000 files | Excel Discussion (Misc queries) | |||
Macro not working with Excel 2003 | Excel Discussion (Misc queries) | |||
Macro working in Excel 2003; not working in Excel 2000 | Excel Programming |