Thank you John - I believe you are correct in your diagnosis and solution.
The code I am using is:
Sub Clear_History()
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1"
End Sub
I have run a loop of repeated queries and with the ClearMyTracksByProcess it is successful for 100 loops - without it often fails in the first 10 loops!
It does raise a couple of further issues if I am trouble you further:
1) A dialog box gets opened Titled Delete Browsing History - is there a way of hiding this? I tried
Application.ScreenUpdating = False
Application.DisplayAlerts = False
But I think because the box is external to Excel they don't have an effect.
2) Sometimes I now get an Invalid Web Query error - this is not the end of the world though since it does not hang so using
On Error Resume Next
allows it to continue.
3) I believe changing the 1 at the end controls exactly what gets cleared. Do you know if any of the other numbers below are relevant to my situation?
Clear_Temp_Files()
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8 "
Clear_Cookies()
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2"
Clear_History()
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1"
Clear_Form_Data()
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16"
Clear_Saved_Passwords()
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32"
Clear_All()
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255"
Clear_Clear_Add_ons_Settings()
Shell "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351"
Thanks again - it is a great help