Results 1 to 17 of 17

Thread: Clear IE Browser Cache and History with VBA

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    78

    Clear IE Browser Cache and History with VBA

    Hi

    Is there a way to clear out the cache and history using VBA code? (not using sendkeys). i know how to clear the cookies folder, but cache and history are an unknown. any help would be appreciated.

    thanks

    tx

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Clear IE Browser Cache and History with VBA

    Yes, but from which office app and what exactly are you trying to do?

    moved
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    78

    Re: Clear IE Browser Cache and History with VBA

    Quote Originally Posted by RobDog888
    Yes, but from which office app and what exactly are you trying to do?

    moved
    from Excel, it is a macro in Excel. i want to be able to clear out the IE browser cache and history using a macro.

    thanks for the reply

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Clear IE Browser Cache and History with VBA

    Hi

    here is something directly from the microsoft's website...

    1) CLEARING CACHE

    Use WinInet API FindFirstURLCacheEntry to find the first cache entry and use FindNextUrlCacheEntry to enumerate through the cache. Use DeleteUrlCacheEntry to delete each entry.

    Note that FindFirstUrlCacheGroup, FindNextUrlCacheGroup, and DeleteUrlCacheGroup are used in the following example. These API functions have only became available with Internet Explorer 5, so proper checking as shown is needed to prevent errors.

    The following steps show you how to use the WinInet API in Visual Basic to clear all the files in the cache.

    1. Create a new Visual Basic standard EXE project.
    2. Create a command button under form1.
    3. Paste the following code in the module of form1:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function FindFirstUrlCacheGroup Lib "wininet.dll" ( _
    4.     ByVal dwFlags As Long, _
    5.     ByVal dwFilter As Long, _
    6.     ByRef lpSearchCondition As Long, _
    7.     ByVal dwSearchCondition As Long, _
    8.     ByRef lpGroupId As Date, _
    9.     ByRef lpReserved As Long) As Long
    10.  
    11. Private Declare Function FindNextUrlCacheGroup Lib "wininet.dll" ( _
    12.     ByVal hFind As Long, _
    13.     ByRef lpGroupId As Date, _
    14.     ByRef lpReserved As Long) As Long
    15.    
    16. Private Declare Function DeleteUrlCacheGroup Lib "wininet.dll" ( _
    17.     ByVal sGroupID As Date, _
    18.     ByVal dwFlags As Long, _
    19.     ByRef lpReserved As Long) As Long
    20.    
    21. Private Declare Function FindFirstUrlCacheEntry Lib "wininet.dll" Alias "FindFirstUrlCacheEntryA" ( _
    22.     ByVal lpszUrlSearchPattern As String, _
    23.     ByRef lpFirstCacheEntryInfo As INTERNET_CACHE_ENTRY_INFO, _
    24.     ByRef lpdwFirstCacheEntryInfoBufferSize As Long) As Long
    25.    
    26. Private Type INTERNET_CACHE_ENTRY_INFO
    27.     dwStructSize As Long
    28.     szRestOfData(1024) As Long
    29. End Type
    30.  
    31. Private Declare Function DeleteUrlCacheEntry Lib "wininet.dll" Alias "DeleteUrlCacheEntryA" ( _
    32.     ByVal lpszUrlName As Long) As Long
    33.  
    34. Private Declare Function FindNextUrlCacheEntry Lib "wininet.dll" Alias "FindNextUrlCacheEntryA" ( _
    35.     ByVal hEnumHandle As Long, _
    36.     ByRef lpNextCacheEntryInfo As INTERNET_CACHE_ENTRY_INFO, _
    37.     ByRef lpdwNextCacheEntryInfoBufferSize As Long) As Long
    38.  
    39. Private Const CACHGROUP_SEARCH_ALL = &H0
    40. Private Const ERROR_NO_MORE_FILES = 18
    41. Private Const ERROR_NO_MORE_ITEMS = 259
    42. Private Const CACHEGROUP_FLAG_FLUSHURL_ONDELETE = &H2
    43. Private Const BUFFERSIZE = 2048
    44.  
    45. Private Sub Command1_Click()
    46.     Dim sGroupID As Date
    47.     Dim hGroup As Long
    48.     Dim hFile As Long
    49.     Dim sEntryInfo As INTERNET_CACHE_ENTRY_INFO
    50.     Dim iSize As Long
    51.        
    52.     On Error Resume Next
    53.    
    54.     ' Delete the groups
    55.     hGroup = FindFirstUrlCacheGroup(0, 0, 0, 0, sGroupID, 0)
    56.    
    57.     ' To avoid error using it with IE4 as FindFirstUrlCacheGroup is not implemented
    58.     If Err.Number <> 453 Then
    59.         If (hGroup = 0) And (Err.LastDllError <> 2) Then
    60.             MsgBox "An error occurred enumerating the cache groups" & Err.LastDllError
    61.             Exit Sub
    62.         End If
    63.     Else
    64.         Err.Clear
    65.     End If
    66.    
    67.     If (hGroup <> 0) Then
    68.         'we succeeded in finding the first cache group.. enumerate and
    69.         'delete
    70.         Do
    71.             If (0 = DeleteUrlCacheGroup(sGroupID, CACHEGROUP_FLAG_FLUSHURL_ONDELETE, 0)) Then
    72.                
    73.                ' To avoid error using it with IE4 as FindFirstUrlCacheGroup is not implemented
    74.                If Err.Number <> 453 Then
    75.                  MsgBox "Error deleting cache group " & Err.LastDllError
    76.                  Exit Sub
    77.                Else
    78.                   Err.Clear
    79.                End If
    80.             End If
    81.             iSize = BUFFERSIZE
    82.             If (0 = FindNextUrlCacheGroup(hGroup, sGroupID, iSize)) And (Err.LastDllError <> 2) Then
    83.                 MsgBox "Error finding next url cache group! - " & Err.LastDllError
    84.             End If
    85.         Loop Until Err.LastDllError = 2
    86.     End If
    87.  
    88.   ' Delete the files
    89.     sEntryInfo.dwStructSize = 80
    90.     iSize = BUFFERSIZE
    91.     hFile = FindFirstUrlCacheEntry(0, sEntryInfo, iSize)
    92.     If (hFile = 0) Then
    93.         If (Err.LastDllError = ERROR_NO_MORE_ITEMS) Then
    94.             GoTo done
    95.         End If
    96.         MsgBox "ERROR: FindFirstUrlCacheEntry - " & Err.LastDllError
    97.         Exit Sub
    98.     End If
    99.     Do
    100.         If (0 = DeleteUrlCacheEntry(sEntryInfo.szRestOfData(0))) _
    101.             And (Err.LastDllError <> 2) Then
    102.             Err.Clear
    103.         End If
    104.         iSize = BUFFERSIZE
    105.         If (0 = FindNextUrlCacheEntry(hFile, sEntryInfo, iSize)) And (Err.LastDllError <> ERROR_NO_MORE_ITEMS) Then
    106.             MsgBox "Error:  Unable to find the next cache entry - " & Err.LastDllError
    107.             Exit Sub
    108.         End If
    109.     Loop Until Err.LastDllError = ERROR_NO_MORE_ITEMS
    110. done:
    111.     MsgBox "cache cleared"
    112.     Command1.Enabled = True
    113. End Sub

    Hope this helps....

    Let me see if i can find something for the 'History'
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    78

    Re: Clear IE Browser Cache and History with VBA

    thanks

    i found something very similar, but the history option is still somewhat elusive.

    also, was wondernig if there is a way to tweak the code so it is not form dependent.

    tx

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Clear IE Browser Cache and History with VBA

    I think I found something...

    I am not sure. i haven't tested it yet...

    VB Code:
    1. ' Clear the IE History
    2.  
    3. Public Sub ClearIEHistory()
    4.     Const HKEY_CURRENT_USER = &H80000001
    5.     Dim sKey As String
    6.    
    7.     sKey = "Software\Microsoft\Internet Explorer\TypedURLs"
    8.     ' delete the key that contains the URLs the history
    9.     DeleteRegistryKey HKEY_CURRENT_USER, sKey
    10.     ' recreate the key, empty
    11.     CreateRegistryKey HKEY_CURRENT_USER, sKey
    12. End Sub

    you will require the DeleteRegistryKey and CreateRegistryKey routines which are mentioned below:


    DELETE REGISTRY KEY

    VB Code:
    1. Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" _
    2.     (ByVal hKey As Long, ByVal lpSubKey As String) As Long
    3.  
    4. ' Delete a registry key
    5. '
    6. ' Under Windows NT it doesn't work if the key contains subkeys
    7.  
    8. Sub DeleteRegistryKey(ByVal hKey As Long, ByVal KeyName As String)
    9.     RegDeleteKey hKey, KeyName
    10. End Sub

    CREATE REGISTRY KEY

    VB Code:
    1. Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias _
    2.     "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
    3.     ByVal Reserved As Long, ByVal lpClass As Long, ByVal dwOptions As Long, _
    4.     ByVal samDesired As Long, ByVal lpSecurityAttributes As Long, _
    5.     phkResult As Long, lpdwDisposition As Long) As Long
    6. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As _
    7.     Long
    8.  
    9. Const KEY_READ = &H20019  ' ((READ_CONTROL Or KEY_QUERY_VALUE Or
    10.                           ' KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not
    11.                           ' SYNCHRONIZE))
    12. Const REG_OPENED_EXISTING_KEY = &H2
    13.  
    14. ' Create a registry key, then close it
    15. ' Returns True if the key already existed, False if it was created
    16.  
    17. Function CreateRegistryKey(ByVal hKey As Long, ByVal KeyName As String) As _
    18.     Boolean
    19.     Dim handle As Long, disposition As Long
    20.    
    21.     If RegCreateKeyEx(hKey, KeyName, 0, 0, 0, 0, 0, handle, disposition) Then
    22.         Err.Raise 1001, , "Unable to create the registry key"
    23.     Else
    24.         ' Return True if the key already existed.
    25.         CreateRegistryKey = (disposition = REG_OPENED_EXISTING_KEY)
    26.         ' Close the key.
    27.         RegCloseKey handle
    28.     End If
    29. End Function

    I don't know if this is what you want... Hope it helps
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    78

    Re: Clear IE Browser Cache and History with VBA

    thanks for the code. it clears the address bar it seems, but not the history.

    thanks for the input

  8. #8
    New Member
    Join Date
    May 2007
    Posts
    11

    Re: Clear IE Browser Cache and History with VBA

    I am trying to do something similar in excel but am not sure how I can create a new EXE project? Can I run the same code from a module?
    Also will this work for IE7?

    Any inputs will be very helpful as I just started coding in VB-Excel. thank you

  9. #9
    New Member
    Join Date
    Sep 2008
    Posts
    2

    Re: Clear IE Browser Cache and History with VBA

    Hi,

    I am newbie to VBA.

    Thank you very much for ur code.

    It saved my life at the dead end.

    Its working fine in my environment Window XP and MsWord 2003

    Thanks a lot.

    With Regards,
    Ashok,



    Quote Originally Posted by koolsid
    Hi

    here is something directly from the microsoft's website...

    1) CLEARING CACHE

    Use WinInet API FindFirstURLCacheEntry to find the first cache entry and use FindNextUrlCacheEntry to enumerate through the cache. Use DeleteUrlCacheEntry to delete each entry.

    Note that FindFirstUrlCacheGroup, FindNextUrlCacheGroup, and DeleteUrlCacheGroup are used in the following example. These API functions have only became available with Internet Explorer 5, so proper checking as shown is needed to prevent errors.

    The following steps show you how to use the WinInet API in Visual Basic to clear all the files in the cache.

    1. Create a new Visual Basic standard EXE project.
    2. Create a command button under form1.
    3. Paste the following code in the module of form1:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function FindFirstUrlCacheGroup Lib "wininet.dll" ( _
    4.     ByVal dwFlags As Long, _
    5.     ByVal dwFilter As Long, _
    6.     ByRef lpSearchCondition As Long, _
    7.     ByVal dwSearchCondition As Long, _
    8.     ByRef lpGroupId As Date, _
    9.     ByRef lpReserved As Long) As Long
    10.  
    11. Private Declare Function FindNextUrlCacheGroup Lib "wininet.dll" ( _
    12.     ByVal hFind As Long, _
    13.     ByRef lpGroupId As Date, _
    14.     ByRef lpReserved As Long) As Long
    15.    
    16. Private Declare Function DeleteUrlCacheGroup Lib "wininet.dll" ( _
    17.     ByVal sGroupID As Date, _
    18.     ByVal dwFlags As Long, _
    19.     ByRef lpReserved As Long) As Long
    20.    
    21. Private Declare Function FindFirstUrlCacheEntry Lib "wininet.dll" Alias "FindFirstUrlCacheEntryA" ( _
    22.     ByVal lpszUrlSearchPattern As String, _
    23.     ByRef lpFirstCacheEntryInfo As INTERNET_CACHE_ENTRY_INFO, _
    24.     ByRef lpdwFirstCacheEntryInfoBufferSize As Long) As Long
    25.    
    26. Private Type INTERNET_CACHE_ENTRY_INFO
    27.     dwStructSize As Long
    28.     szRestOfData(1024) As Long
    29. End Type
    30.  
    31. Private Declare Function DeleteUrlCacheEntry Lib "wininet.dll" Alias "DeleteUrlCacheEntryA" ( _
    32.     ByVal lpszUrlName As Long) As Long
    33.  
    34. Private Declare Function FindNextUrlCacheEntry Lib "wininet.dll" Alias "FindNextUrlCacheEntryA" ( _
    35.     ByVal hEnumHandle As Long, _
    36.     ByRef lpNextCacheEntryInfo As INTERNET_CACHE_ENTRY_INFO, _
    37.     ByRef lpdwNextCacheEntryInfoBufferSize As Long) As Long
    38.  
    39. Private Const CACHGROUP_SEARCH_ALL = &H0
    40. Private Const ERROR_NO_MORE_FILES = 18
    41. Private Const ERROR_NO_MORE_ITEMS = 259
    42. Private Const CACHEGROUP_FLAG_FLUSHURL_ONDELETE = &H2
    43. Private Const BUFFERSIZE = 2048
    44.  
    45. Private Sub Command1_Click()
    46.     Dim sGroupID As Date
    47.     Dim hGroup As Long
    48.     Dim hFile As Long
    49.     Dim sEntryInfo As INTERNET_CACHE_ENTRY_INFO
    50.     Dim iSize As Long
    51.        
    52.     On Error Resume Next
    53.    
    54.     ' Delete the groups
    55.     hGroup = FindFirstUrlCacheGroup(0, 0, 0, 0, sGroupID, 0)
    56.    
    57.     ' To avoid error using it with IE4 as FindFirstUrlCacheGroup is not implemented
    58.     If Err.Number <> 453 Then
    59.         If (hGroup = 0) And (Err.LastDllError <> 2) Then
    60.             MsgBox "An error occurred enumerating the cache groups" & Err.LastDllError
    61.             Exit Sub
    62.         End If
    63.     Else
    64.         Err.Clear
    65.     End If
    66.    
    67.     If (hGroup <> 0) Then
    68.         'we succeeded in finding the first cache group.. enumerate and
    69.         'delete
    70.         Do
    71.             If (0 = DeleteUrlCacheGroup(sGroupID, CACHEGROUP_FLAG_FLUSHURL_ONDELETE, 0)) Then
    72.                
    73.                ' To avoid error using it with IE4 as FindFirstUrlCacheGroup is not implemented
    74.                If Err.Number <> 453 Then
    75.                  MsgBox "Error deleting cache group " & Err.LastDllError
    76.                  Exit Sub
    77.                Else
    78.                   Err.Clear
    79.                End If
    80.             End If
    81.             iSize = BUFFERSIZE
    82.             If (0 = FindNextUrlCacheGroup(hGroup, sGroupID, iSize)) And (Err.LastDllError <> 2) Then
    83.                 MsgBox "Error finding next url cache group! - " & Err.LastDllError
    84.             End If
    85.         Loop Until Err.LastDllError = 2
    86.     End If
    87.  
    88.   ' Delete the files
    89.     sEntryInfo.dwStructSize = 80
    90.     iSize = BUFFERSIZE
    91.     hFile = FindFirstUrlCacheEntry(0, sEntryInfo, iSize)
    92.     If (hFile = 0) Then
    93.         If (Err.LastDllError = ERROR_NO_MORE_ITEMS) Then
    94.             GoTo done
    95.         End If
    96.         MsgBox "ERROR: FindFirstUrlCacheEntry - " & Err.LastDllError
    97.         Exit Sub
    98.     End If
    99.     Do
    100.         If (0 = DeleteUrlCacheEntry(sEntryInfo.szRestOfData(0))) _
    101.             And (Err.LastDllError <> 2) Then
    102.             Err.Clear
    103.         End If
    104.         iSize = BUFFERSIZE
    105.         If (0 = FindNextUrlCacheEntry(hFile, sEntryInfo, iSize)) And (Err.LastDllError <> ERROR_NO_MORE_ITEMS) Then
    106.             MsgBox "Error:  Unable to find the next cache entry - " & Err.LastDllError
    107.             Exit Sub
    108.         End If
    109.     Loop Until Err.LastDllError = ERROR_NO_MORE_ITEMS
    110. done:
    111.     MsgBox "cache cleared"
    112.     Command1.Enabled = True
    113. End Sub

    Hope this helps....

    Let me see if i can find something for the 'History'

  10. #10
    New Member
    Join Date
    Sep 2008
    Posts
    2

    Re: Clear IE Browser Cache and History with VBA

    Hi All,

    It was working in XP and Ms word 2002 Environment.

    When I migrated my application to Windows 2003 and Ms word 2003. There is a exception given as err.LastDllError=87.

    Please help me asap.

    I managing with the last result in XP environment. I need to migrate to windows 2003.

    Solution applaudable.
    With regards,
    AshokKumar.

  11. #11
    Fanatic Member technorobbo's Avatar
    Join Date
    Dec 2008
    Location
    Chicago
    Posts
    864

    Re: Clear IE Browser Cache and History with VBA

    Keep it simple

    Sub Clear_Temp_Files()
    Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8 "
    End Sub


    Sub Clear_Cookies()
    Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2"
    End Sub



    Sub Clear_History()
    Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1"
    End Sub



    Sub Clear_Form_Data()
    Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16"
    End Sub



    Sub Clear_Saved_Passwords()
    Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32"
    End Sub



    Sub Clear_All()
    Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255"
    End Sub



    Sub Clear_Clear_Add_ons_Settings()
    Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351"
    End Sub

  12. #12

    Smile Re: Clear IE Browser Cache and History with VBA

    Awww!
    Its simple to use!
    Thanks Technorobbo!

  13. #13
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Clear IE Browser Cache and History with VBA

    I am in AWEEEEEE

    Very good.

  14. #14
    Fanatic Member
    Join Date
    Oct 2007
    Posts
    544

    Re: Clear IE Browser Cache and History with VBA

    I wonder if there is also a simple shell command to change proxy settings in internet explorer.

  15. #15
    Junior Member
    Join Date
    Jan 2011
    Posts
    27

    Re: Clear IE Browser Cache and History with VBA

    hi, i want to set internet zone setting to custom level...(high or low) with vb6
    is there any way to do this.?

    or any other way?
    help please.
    i just want to disable or enable java scripting in web browser with vb6.
    i'll do it manually and it's working perfect. but i want to do this with my project automatically with coding.
    anyone here to solve this problem.

    thankx in advance.

  16. #16
    Junior Member
    Join Date
    Jan 2011
    Posts
    27

    Re: Clear IE Browser Cache and History with VBA

    hi, i want to set internet zone setting to custom level...(high or low) with vb6
    is there any way to do this.? and adding or removing site to trusted zone or restricted zone.

    Example:
    to clear ie history.
    Code:
    Sub Clear_History()
     Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1"
     End Sub
    or any other way?
    help please.
    i just want to disable or enable java scripting in web browser with vb6.
    i'll do it manually and it's working perfect. but i want to do this with my project automatically with coding.
    anyone here to solve this problem.

  17. #17
    New Member
    Join Date
    May 2012
    Posts
    1

    Post Re: Clear IE Browser Cache and History with VBA

    Hi,
    I'm sorry that I answer (to) the old question, but I want not open a new topic.
    My code is the following:
    For an example:

    Private Sub xxxx
    Code:
    Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1")
    Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2")
    Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8 ")
    Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16")
    Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32")
    Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255")
    Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351")
    End Sub

    Best regards
    TheSuperego

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width