Delete Temporary internet files

  • Thread starter Thread starter junx13
  • Start date Start date
J

junx13

Hi,
Anyone know how I can call a macro to delete my temp internet file
directory after I close the workbook
 
AFAIK temp internet files are best deleted from within
DOS, manually or via a Batch file. Probably requires IE
not loaded and possibly "not logged in".

Goto Google / Groups and search:
"delete temp* internet files batch-file"

Don't see why a Batch file cannot be called from VBA. If
lucky, some brave person might put it all together, test
and advise us!

Regards,
Peter
 
That links to a vb6 project which in turn requires a
reference to the author's "olelib.tlb". Need to download
that and install per his instructions. It looks very
clever.

Following seems to work for me on my standalone W98.
Try "at your own risk" having searched and read as I
previously suggested.

In a text editor save with a "bat" extension,
say "TestDel.bat" in c:\

smartdrv
deltree /Y c:\windows\history
deltree /Y c:\windows\tempor~1
@cls
@exit

Sub DelTempIE()
retVal = Shell("C:\TestDel.bat")
End Sub

If you want it to run when your wb exits put it in the
workbook's BeforeClose event. I assume this should be
done with IE not running.

Regards,
Peter
 
hmm.. I've thought about it though.. let us say you wanted to downloa
it for viewing from the web. since it is downloaded into the tem
folder when it is opened, will running the macro before close remov
it?

Also it appears that your bat file removes the directory tree of th
temporary internet files, does that affect the functioning of IE a
all
 
hmm.. I've thought about it though.. let us say you
wanted to download it for viewing from the web. since it
is downloaded into the temp folder when it is opened,
will running the macro before close remove it?

I would strongly urge you not to even think about trying
to clean up temp internet files on other peoples systems,
with this DOS method or any other. Some would classify
that as a virus, even if only trying to selectively delete
your own your file that someone has downloaded.
Also it appears that your bat file removes the directory
tree of thetemporary internet files, does that affect the
functioning of IE at all?

Reading what others far more knowledge than I say on the
subject (the search I originally suggested) the IE folders
are recreated if not found. That indeed seems to be the
case, but I've only tested with IE NOT running.
Personally I would not want to run the bat file
automatically when closing a wb, at the very least get
Msgbox confirmation. But you did ask!

FWIW, several suggest putting the deltree commands in
AutoExec.Bat to do a clean up on start-up.
Other suggested delete commands:

deltree /Y c:\windows\cookies
deltree /Y c:\windows\temp\

Note the extra "\" with the system temp folder only
deletes contents, not the folder itself.

Regards,
Peter
 
Thanks peter... I know it's not right to do this... but the initia
idea is to stop someone from actually going into the temp interne
folder to prevent them from taking my file and mess around...

Thus I thought that if I could delete the file from the cache afte
the user is done reading it , it could suit my purposes.

Perhaps you have a better idea
 
What's to stop anyone right-clicking link and SaveAs.
Search this ng for ways of protecting your wb & code as
much as possible, which isn't much. Passwords, code in
BeforeClose and/or BeforeSave to delete stuff, read only.
Might keep out the uninitiated but even they could copy
sheets.

Regards,
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top