LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro problem in Excel pd Excel Discussion (Misc queries) 2 March 14th 06 05:49 AM
problem with macro on Excel Captain Picard Excel Worksheet Functions 0 February 1st 06 09:20 PM
excel macro problem yvautrin Excel Programming 0 April 12th 05 08:27 PM
Excel Macro Problem!? hbp78 Excel Programming 4 June 17th 04 08:04 PM
Excel XP macro problem Paul Reeve Excel Programming 1 November 10th 03 11:26 PM


All times are GMT +1. The time now is 06:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"