Message-ID: <37780844.9125BD92@wanadoo.fr> Date: Tue, 29 Jun 1999 00:41:56 +0100 From: Laurent longre Organization: Fan-Club de Zaza - section du =?iso-8859-1?Q?Rh=F4ne?= (69) X-Mailer: Mozilla 4.5 [fr] (Win95; I) X-Accept-Language: fr MIME-Version: 1.0 to: Philippe DEFIVES Subject: Re: commende DOS (2) References: <01bebdce$517b4ba0$5b70fdcf@xxx> <377212B8.4B1D@wanadoo.fr> Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Newsgroups: microsoft.public.fr.excel NNTP-Posting-Host: blyon1-4-133.abo.wanadoo.fr 193.250.210.133 Path: cppssbbsa01.microsoft.com!cppssbbsa02.microsoft.com Lines: 49 Xref: cppssbbsa01.microsoft.com microsoft.public.fr.excel:10976 Solution beaucoup plus simple et élégante. Quel âne fais-je... :-( Const NomFic As String = "C:\Dir.prn" dim LgFic As long Open NomFic for Output As 1: Close 1 Shell "Command.com /c dir c:\*.* /v/s >" & NomFic do: loop Until FileLen(NomFic) LgFic = FileLen(NomFic) Shell "Command.com /c dir c:\*.* /v/s/ah >>" & NomFic do: loop Until FileLen(NomFic) > LgFic Laurent Philippe DEFIVES a écrit : > > le code suivant ne marche pas car il semblerait que VB ne traite pas les > commande en séquentiel > si on exécute en pas à pas cela marche > si on exécute en rél message du style "fichier en cours d'utilisation" > > y-a-t 'il un paramètre qui fasse que VB ne démarre l'instruction suivante > que si la précédente est terminé ? > > Const NomFic As String = "C:\dir.prn" > Open NomFic for Output As 1 > Close 1 > Shell "Command.com /c dir c:\*.* /v /s >" & NomFic > Shell "Command.com /c dir c:\*.* /v /s /a:h >>" & NomFic > Shell "Command.com /c dir d:\*.* /v /s >>" & NomFic > Shell "Command.com /c dir d:\*.* /v /s /a:h >>" & NomFic > Laurent longre a écrit dans le message : > 377212B8.4B1D@wanadoo.fr... > > Isabelle wrote: > > > > > > J'essais d'écrire cette commende DOS en VBA Excel 97 > > > Quelqu'un peut-il m'aider ? > > > > > > C:\>dir c:\isabelle \*.xls >isabelle\liste_fichier.xls > > > > Essaie d'utiliser quelque-chose de ce style : > > > > Const NomFic As String = "C:\Isabelle\Liste_fichiers" > > Open NomFic for Output As 1 > > Close 1 > > Shell "Command.com /c dir/b C:\Isabelle\*.xls | sort > " & NomFic > > do: loop Until FileLen(NomFic) > > application.screenupdating = false > > workbooks.Open NomFic > > if Dir(NomFic & ".xls") <> "" then Kill NomFic & ".xls" > > activeworkbook.saveas NomFic, xlWorkbookNormal > > Kill NomFic > > > > Si tu as Excel 97, il vaut mieux utiliser l'objet > > application.FileSearch. > > > > Laurent > >