Simple Shell Commands
Yes I think that is clear. My early questions were based upon naivete.
Thank you.
W
"Tom Lavedas" wrote in message
...
Your misinterpreting Mr. Ogilvy's suggestions. They (ChDir and ChDrive)
are internal of the Excel VBA methods and thus do not require the Shell. To
do that in a command shell requires the command processor, I discussed
earlier. However, changing them in the command shell does NOT cause the
referenced folder to change in the parent Excel environment. To do that you
must issue the statements per Mr. Ogilvy's post (without any reference to
the Shell method).
Does that clear it up?
BTW, that's NOT what your original post asked for.
Tom Lavedas
===========
----- cogent wrote: -----
Hello Tom
The following continues to give me "file not found"
shell "chdrive " & ActiveWorkbook.path
shell "Chdir " & Activeworkbook.Path
This is really stumping me (it just shouldn't be this hard). Maybe I
am
tired but... what is my problem?
"Tom Ogilvy" wrote in message
...
chdrive ActiveWorkbook.path
Chdir Activeworkbook.Path
--
Regards,
Tom Ogilvy
"cogent" wrote in message
...
Hello
Thank you for your comments.
Really all I wanted to do was to change to the directory of the
active
workbook. This should work:
Shell "CD /D" & activeworkbook.path
but it does not. What am I doing wrong?
W
"Tom Lavedas" wrote in message
...
Unles you are doing this exclusively on a Win 95/98/Me equipped
machine,
you should not use the Command.com command processor. In fact,
the best
thing would be to use the system defined %COMSPEC% environment
variable
to
locate the command processor in all casses. It keeps things neat
and
tidy,
regardless of the OS version in use.
More specifically, I believe you need a statement like this
....
Shell "%comspec% /c CD" & activeworkbook.path & _
" | copy dest.txt+source.txt dest.txt /b"
This runs the statement ...
CD activeworkbook_path | copy dest.txt+source.txt dest.txt
/b
as it would from the command prompt. Note that relative
addressing
requires the removal of the absolute drive pathspecs from all of
the
file
names in the COPY statement.
Tom Lavedas
===========
----- cogent wrote: -----
Hello
Quick help, please.
In the following command:
Shell "command.com /c" & _
"copy c:\dest.txt+c:\source.txt c:\dest.txt /b"
what does the Shell "command.com /c" accomplish?
I am running shell commands that I want to make sure are
executed
with the
active path at the prompt so that the commands behind it are
able
to
be
effected on a RELATIVE basis. How?
Like this:?
Shell "command.com " activeworkbook.path & _
"copy c:\dest.txt+c:\source.txt c:\dest.txt /b"
The macro is run in a thumb drive where the drive number
may
vary,
but the
shell commands must be executed in the directory on the
thumb
drive.
Please help.
W
|