01-20-2011, 10:44 AM
(This post was last modified: 01-22-2011, 12:51 AM by cdesserich.)
The most reliable way I know would be to edit the registry settings. Here's some subroutines that will disable/enable cookies (you have to call the sub, then open the browser, or restart the browser after calling it). Instead of just calling the enable sub, you might want to read the registry setting before altering it (ShellObj.RegRead) so that you can set it back where it was. Setting it to 0 will allow ALL cookies. Refer to this for more info on the registry settings for IE and what they mean: http://support.microsoft.com/kb/182569
Code:
'@Description Disables cookies in Internet Explorer for the current user. Browser(s) must be restarted for this to take effect!
Public Sub DisableCookies()
Set ShellObj = CreateObject("WScript.Shell")
ShellObj.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\1A10", 3, "REG_DWORD"
Set ShellObj = Nothing
End Sub
'@Description Enables cookies in Internet Explorer for the current user. Browser(s) must be restarted for this to take effect!
Public Sub EnableCokies()
Set ShellObj = CreateObject("WScript.Shell")
ShellObj.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\1A10", 0, "REG_DWORD"
Set ShellObj = Nothing
End Sub