Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Running A Shell Command In VBA

Hi,

I'm trying to run the following shell command in VBA but it is telling
me the file is not found. My home directory when I bring up the
command prompt manually is C:\Documents and settings\robin.grossman,
which I think is the problem. What should I do?

Shell Environ$("COMSPEC") & "DEL Z:\Client Services\Operations
\PrintedVersion.pdf"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Running A Shell Command In VBA

First, VBA has its own version to delete/erase.

Kill "z:\client services\operations\printedversion.pdf"

But you could try adding a space character in front of the "DEL" string:

Shell Environ$("COMSPEC") _
& " DEL Z:\Client Services\Operations\PrintedVersion.pdf"

But I bet you'll need to surround the filename with double quotes since it
contains spaces:

Shell Environ$("COMSPEC") _
& " DEL ""Z:\Client Services\Operations\PrintedVersion.pdf"""

(all untested)

R Tanner wrote:

Hi,

I'm trying to run the following shell command in VBA but it is telling
me the file is not found. My home directory when I bring up the
command prompt manually is C:\Documents and settings\robin.grossman,
which I think is the problem. What should I do?

Shell Environ$("COMSPEC") & "DEL Z:\Client Services\Operations
\PrintedVersion.pdf"


--

Dave Peterson
Reply
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
Running Shell Jeff Excel Discussion (Misc queries) 0 January 28th 08 04:50 PM
running commands from hte shell Ruthless Dog Excel Programming 4 May 17th 05 02:38 PM
shell command running very slow TTD Excel Programming 0 December 1st 04 09:43 AM
Shell Command JOHN Excel Programming 1 November 17th 04 10:39 AM
SHELL command Robin Clay[_3_] Excel Programming 3 October 17th 03 02:50 PM


All times are GMT +1. The time now is 05:59 PM.

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

About Us

"It's about Microsoft Excel"