PC Review


Reply
 
 
BigPig
Guest
Posts: n/a
 
      1st Aug 2008
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.
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      1st Aug 2008
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.

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      1st Aug 2008
I don't think you can in "straight VB" as the Shell command spawns an
program independent of the program it was executed in. I guess you could use
the Windows API to find the shelled window by its title text and close it
with another API call. Before trying to construct all that, would making
your "script" (the one that shelled out to explorer.exe) wait for the
shelled out program to close (still require API function calls) and then
rename it at that point? Would that be an acceptable approach?

Rick


"BigPig" <(E-Mail Removed)> wrote in message
news:96A28C7A-DCD4-43C6-B66E-(E-Mail Removed)...
> 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.


 
Reply With Quote
 
BigPig
Guest
Posts: n/a
 
      1st Aug 2008
Gary''s Student,

Thank you! I probably should have spent more time thinking about it.
 
Reply With Quote
 
BigPig
Guest
Posts: n/a
 
      1st Aug 2008
Hi Rick,

You're right. I guess I was just trying to get the "shell..." to close
without changing most of what I wrote. I'm going to try fso.copyfile and then
go back and kill the original file.

Thank you very much.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
close shell issue carrie schmid Microsoft Access Form Coding 0 29th May 2009 04:14 PM
Close Shell =?Utf-8?B?Q2Fub25DaHJpcw==?= Microsoft Excel Programming 1 19th Jun 2007 07:09 PM
Close shell =?Utf-8?B?VFRM?= Microsoft Access VBA Modules 2 7th Sep 2005 01:22 AM
how to close shell application? Josu Zamarripa Windows XP Embedded 3 28th Apr 2004 01:02 PM
IE has encountered a problem and needs to close - shell.dll Mwilson Windows XP Internet Explorer 1 28th Aug 2003 05:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 PM.