ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Temporary internet files (https://www.excelbanter.com/excel-programming/302085-delete-temporary-internet-files.html)

junx13[_5_]

Delete Temporary internet files
 
Hi,
Anyone know how I can call a macro to delete my temp internet file
directory after I close the workbook

--
Message posted from http://www.ExcelForum.com


Peter T[_3_]

Delete Temporary internet files
 
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

-----Original Message-----
Hi,
Anyone know how I can call a macro to delete my temp

internet files
directory after I close the workbook?


---
Message posted from http://www.ExcelForum.com/

.


junx13[_6_]

Delete Temporary internet files
 
Thanks for the reply.. but I actually need the actual code for doin
this ... I found one on the net he

http://www.mvps.org/emorcillo/vb6/inet/index.shtml

But I can't manage to get it to work

--
Message posted from http://www.ExcelForum.com


Peter T[_3_]

Delete Temporary internet files
 
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

-----Original Message-----
Thanks for the reply.. but I actually need the actual

code for doing
this ... I found one on the net he

http://www.mvps.org/emorcillo/vb6/inet/index.shtml

But I can't manage to get it to work!


---
Message posted from http://www.ExcelForum.com/

.


junx13[_7_]

Delete Temporary internet files
 
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

--
Message posted from http://www.ExcelForum.com


Peter T[_3_]

Delete Temporary internet files
 

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


junx13[_8_]

Delete Temporary internet files
 
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

--
Message posted from http://www.ExcelForum.com


Peter T[_3_]

Delete Temporary internet files
 
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

...I know it's not right to do this...

Phew!


-----Original Message-----
Thanks peter... I know it's not right to do this... but

the initial
idea is to stop someone from actually going into the temp

internet
folder to prevent them from taking my file and mess

around...

Thus I thought that if I could delete the file from the

cache after
the user is done reading it , it could suit my purposes.

Perhaps you have a better idea?


---
Message posted from http://www.ExcelForum.com/

.



All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com