Thread: Close Shell
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Close Shell

If you just want to delete the original file, use the Kill command. If you
want to get rid of the Shell Object then:

Sub pig()
x = Shell("explorer.exe C:\Temp\third.xls")
Set x = Nothing
End Sub

--
Gary''s Student - gsnu200797


"BigPig" wrote:

Hi All,

With this script I open a file:

Shell "explorer.exe " & ReNameFolder & SelectedFile

Through another script I rename the file and save it in a different folder.

Name ReNameFolder & SelectedFile As SQFolder & NewFileNm

How do I close the "Shell.." before I run the rename script?

I tried dimming Filename as variant, filename=shell... and then
filename.close or quit, but I got an object error.

Basically I want to take a file (could be a pdf, tif, or xfdl), rename it
and save it to a different folder. And don't want to have to go back and
delete it once done.

Any help or suggestions would be greatly appreciated.

Thanks.