LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Temporary Internet Files

It worked for me. It might be a permissions issue. What exactly leads you to
believe that it doesn't work? Does the code blow up, is there a compiler
error? Just what does "doesn't work" mean?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"johnc3640" wrote in message
...
Thank you very much for the ry bt the code doesnt work

"Chip Pearson" wrote:

Try the following code:


Sub DeleteTempFolders()
Dim FSO As Object
Dim NumDeleted As Long
Dim NumSkipped As Long
Dim FF As Object
' CHANGE VALUE OF FOLDERNAME
Const FOLDERNAME = _
"C:\Users\Pearson\AppData\Local\Microsoft\Windows\ Temporary
Internet
Files"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FF = FSO.GetFolder(FOLDERNAME)
ClearFolder FF, NumDeleted, NumSkipped
Debug.Print "Number Deleted: " & CStr(NumDeleted), "Number Skipped: "
&
CStr(NumSkipped)
End Sub

Sub ClearFolder(WhatFolder As Object, NumDeleted As Long, NumSkipped As
Long)
Dim SubF As Object
Dim F As Object

On Error Resume Next
For Each F In WhatFolder.Files
Err.Clear
F.Delete
If Err.Number = 0 Then
NumDeleted = NumDeleted + 1
Else
NumSkipped = NumSkipped + 1
End If
Next F

For Each SubF In WhatFolder.SubFolders
ClearFolder SubF, NumDeleted, NumSkipped
Next SubF
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"johnc3640" wrote in message
...
I have recently upgraded to Vista and Office 2007. I have an automated
Excel
worksheet that collects a lot of data from the internet using web
queries.
However, with Vista my temporary internet folder becomes full and the
web
queries stop working. I can correct the problem by deleting those
files
in
IE (this is not a practical solution because my prior automated update
process needs continual live interface). Is anyone aware of a VB
script
that
might solve this problem - ie deleting temporary internet files?

I have tried this one but it doesnt work :

Sub Killfile()
Dim MyFile As String 'This line of code is optional
MyFile = "c:\Users\*user*\AppData\Local\Microsoft\Windows\T emporary
Internet
Files\*.htm"
mypath = CurDir
Kill MyFile
End Sub




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I open temporary internet files mdoyer Excel Discussion (Misc queries) 3 October 12th 09 07:41 AM
Delete Temporary Internet Files with VBA Newt[_2_] Excel Programming 2 March 15th 07 05:27 PM
Web query failing due to too many temporary internet files? gt Excel Programming 2 March 8th 07 12:43 AM
Delete Temporary internet files junx13[_5_] Excel Programming 7 June 25th 04 12:54 PM
Listing Temporary Internet Files Alan Phang Excel Programming 3 February 11th 04 04:09 AM


All times are GMT +1. The time now is 06:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"