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" |
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 |
All times are GMT +1. The time now is 11:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com