Hi,
Does anybody know how to execute shell commands such as "copy" in VBA.
Thanks,
Abhishek.
Vince - 04 Apr 2005 09:17 GMT
Simplest method is:
Dim a As String
a = "c:\windows\system32\xcopy c:\wf.exe c:\aa.exe "
Shell (a)
> Hi,
> Does anybody know how to execute shell commands such as "copy" in VBA.
>
> Thanks,
> Abhishek.
Vince - 04 Apr 2005 09:19 GMT
BTW, FWIW, I would rather use the filesystemobject to do file manipulation
like copying, deleting and renaming files than shell system commands.
> Hi,
> Does anybody know how to execute shell commands such as "copy" in VBA.
>
> Thanks,
> Abhishek.
Michael Bednarek - 04 Apr 2005 14:40 GMT
On Mon, 4 Apr 2005 13:06:56 +0530, "Abhishek"
<abhi_narulkar@rediffmail.com> wrote in
microsoft.public.word.vba.general:
> Does anybody know how to execute shell commands such as "copy" in VBA.
By invoking your shell with the appropriate arguments.
Assuming that it's the command COPY of CMD.EXE you desire to execute,
the command might look like:
Shell ("cmd /c copy source.dat target.dat")
For details see CMD /? from a CMD prompt.
However, as Vince suggested, methods native to VBA are probably
preferrable.

Signature
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"