How to clear all the cookies?

I am using windowXP OS, i want to clear all the cookies in the window by clicking a button in VB, how to do?
[108 byte] By [crazyhill] at [2007-11-20 10:51:52]
# 1 Re: How to clear all the cookies?
Simple as this:

Option Explicit

Private Sub Form_Load()

Dim CookiePath As String
CookiePath = Environ$("UserProfile")

If Len(CookiePath) > 0 Then
CookiePath = CookiePath & "\Cookies\"
Else
MsgBox "Cannot find your user profile."
Exit Sub
End If
Dim Cookies As String
Cookies = Dir(CookiePath & "*.txt")

Do While Len(Cookies) > 0
Debug.Print CookiePath & Cookies
If InStr(Cookies, "whatever") > 0 Then
Kill CookiePath & Cookies
End If
Cookies = Dir()
Loop
End Sub
dglienna at 2007-11-9 19:34:21 >
# 2 Re: How to clear all the cookies?
Thank you for your reply.

However, when i try your codes, it still cannot delete the cookies.

I can see that all the cookies files still exist in the Temporary Internet Files.

I want to delete the cookies files in Temporary Internet Files, how to do?
crazyhill at 2007-11-9 19:35:21 >
# 3 Re: How to clear all the cookies?
same code, but substitute "\Local Settings\Temporary Internet Files"
folder
dglienna at 2007-11-9 19:36:19 >
# 4 Re: How to clear all the cookies?
In which location I should substitude the "\Local Settings\Temporary Internet Files"??

I would be very appreciate if you can rewrite the codes again. Thank you!
crazyhill at 2007-11-9 19:37:24 >
# 5 Re: How to clear all the cookies?
Copy this line, then change it, then copy the same code again to delete those files.

CookiePath = CookiePath & "\Cookies\"

set path
kill cookies
set path
kill temp files
dglienna at 2007-11-9 19:38:29 >
# 6 Re: How to clear all the cookies?
I am sure the logic of your codes are correct.

But when I change the codes:

CookiePath = CookiePath & "\Local Settings\Temporary Internet Files\"

In Window Explorer I can see there are a lot of files (including cookies files) inside the CookiePath, but in the program the length of Len(Cookies) return 0...

I don't know why the files cannot be listed......
crazyhill at 2007-11-9 19:39:28 >
# 7 Re: How to clear all the cookies?
Because you have to set the extension of the file type that you want to see.

Cookies = Dir(CookiePath & "*.txt") ' shows only txt files. use *.* for ALL

the subsequent time, use Dir() so it doesn't find the first one over and over.
dglienna at 2007-11-9 19:40:27 >
# 8 Re: How to clear all the cookies?
I have already set :

Cookies = Dir(CookiePath & "*.txt")

but still return zero for Len(Cookies), I don't know why.....
crazyhill at 2007-11-9 19:41:30 >
# 9 Re: How to clear all the cookies?
I believe the suggestion was to use this:

Cookies = Dir(CookiePath & "*.*")

Of course, this applies to msie. Other browsers may store cookies elsewhere, such as Firefox.
WizBang at 2007-11-9 19:42:33 >