ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Temporary Internet Files (https://www.excelbanter.com/excel-programming/401632-temporary-internet-files.html)

johnc3640

Temporary Internet Files
 
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



Chip Pearson

Temporary Internet Files
 
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




johnc3640

Temporary Internet Files
 
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




Chip Pearson

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






All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com