Captain Smith
Active Member
- Joined
- Feb 28, 2003
- Messages
- 324
I have a need to clear Internet Explorer temp files, cookies, history. How do I do this in Excel VBA? I need it to work in both 2003 and 2007.
Thank you!
Thank you!
'=============================================================================
'- DELETE COOKIES : VBA CODE
'=============================================================================
Sub DELETE_COOKIES()
Dim MyFolder As String
'-------------------------------------------------------------------------
'- Cookie folder
MyFolder = "C:\Users\Brian\AppData\Roaming\Microsoft\Windows\Cookies\"
'- Delete all cookies
Kill MyFolder & "*.txt" ' use this with care
'-------------------------------------------------------------------------
'- Windows Temp
MyFolder = "C:\WINDOWS\Temp\"
'- Delete all cookies
Kill MyFolder & "*.tmp" ' use this with care
'-------------------------------------------------------------------------
MsgBox ("Done")
End Sub
'=============================================================================
Rem '=============================================================================
Rem '- DELETE COOKIES : MSDOS BATCH FILE
Rem '- This is an ordinary Notepad text file with suffix .bat instead of .txt
Rem '- Can be run from a shortcut
Rem '=============================================================================
Rem turn off unwanted messages
@ECHO OFF
CLS
Rem -----------------------------------------------------------------------------------------------------------
ECHO ROAMING COOKIES
Rem change to required folder
C:
Rem Cookies --------------------------------------------------------------------------------------------
CD C:\Users\Brian\AppData\Roaming\Microsoft\Windows\Cookies
Rem delete all .txt files
DEL *.txt
Rem Temp Files ------------------------------------------------------------------------------------------
ECHO TEMP FILES
CD C:\WINDOWS\TEMP
DEL *.tmp
Rem --------------------------------------------------------------------------------------------------------------
Rem stop to show results ("press any key ..")
PAUSE