Free Microsoft Excel 2013 Quick Reference

Delete Temporary Internet Files

Hi there,

When I run a webquery to download information from online I have found the common 1004 error to occur very often however I have found that if I delete my temporary internet files prior to running the webquery, this problem does not occur. I therefore require an automated function to delete the temporary internet files however the simple 'Kill' statement does not seem to work. I would be very greateful if anyone could help me create an automated process within VBA to carry out this task.

Cheers, Ben

Post your answer or comment

comments powered by Disqus
Anyone have some vb code to programatically delete internet files?


This is a follow up to an earlier post about web queries

I need to be able to clean out my directory :
"C:Documents and Settings" & Environ("UserName") & "Local SettingsTemporary Internet Files"

But nothing I've tried seems to work.

The kill command doesn't appear to work with wildcards... is there a way I can loop through the directory and delete the files one by one?

Any other thoughts?


I use an Excel 2000 spreadsheet to keep track of my net worth, updating it
daily from a stockmarket summary. Lately it has slowed horribly. I've done
all the usual things, i.e. deleted temporary internet files, defragged,
lowered the security setting that usually slow things up but to no avail.

Any suggestions?


We have denied the delete permission to the user on Windows 2003 server. Now
when user saves the excel file 8 digit alphanumeric temporary files get
generated without any extention where is in word it generated with .tmp
extention. Now as administrator we want to delete these temporary files from
all location with one go. Can you help us.


Anyone know how I can get VBA to return the location of the temporary internet folder. I have a tool which will be used on several different windows op systems and need to be sure the folder location is returned right. I can't assume its going to be C:Documents and settingsLocal SettingsTemporary Internet Files.

Can anyone help?



I'm working on a project for Purchase Order. I want to be abble to save the file into a new folder (Controller), then delete the original file from The old Folder (Purchase order)

Thanks in advance

Sub Save_ToController_folder()

Dim Poselection, Yearselection, Submitted, Dpt

Poselection = ActiveSheet.Cells(1, 1).Value
Yearselection = ActiveSheet.Cells(2, 1).Value
Submitted = ActiveSheet.Cells(3, 1).Value
Dpt = ActiveSheet.Cells(4, 1).Value

ChDir "C:Purchase OrderController"
ActiveWorkbook.SaveAs FileName:= _
"C:Purchase OrderController" & Submitted & "" & Yearselection & "" & Dpt & " " & Poselection & ".xls"

End Sub

On Sunday my wife (an English Teacher) was searching the web for a script for a play that she wants do do for end of term.

Suddenly the Dialup which was connected and working started to dial again.

On investigation in addition to our BTOW conection something called
GB Dialer seemed to have downloaded itself and was dialing as well.

I have deleted the icons, cookies, temporary internet files and tmp files. I did a search for any new files on that date and deleted them and emptied the recycle bin.

I ran Norton and Spybot and they both came up clean.

Then last night my wife went on line again and it appeared again. Any ideas where I ought to look to try and get rid of it?

We also had a message left on our phone saying there was a problem with our telephone connection. We suspect that this was a hoax call connected to one of these premium numbers where you get charged £50 per minute if you ring it.

copy and paste from an internet file and place in word

i need to know how to copy and paste into word?

I have an .mdb accessable via an http path.

I can go into excel, import external data, make the connection and build a pivot table.
It seems to work fine, until I update the database or pass the file to someone else.

Excel is replacing my connection path with a hard coded link to my Temporary Internet Files on C:...

How can I force excel to keep the actual HTTP path as the data source?

Hi ,

I am having a problem of deleting the .txt files(old files).

I am wanting to delete the file after my macro run finish. So anyone know a formula for me to do that?
Hope that someone can solve the problem for me . tq


I have problem with excel. I am using an invoice application which saves each sale operation as a file. first I create a waybill for the logistics department. this operatin is saved to system by the waybill number and the customer code like "###### - Customer code".xls

After that finance department get these files and enters the price for the invoice. at this point I want to do is to rename the file such as

"###### - customer code - invoice number" and save it to another folder.

I can do saving part. but I could not delete the old file. I have found some code but could not modify it to my system.

My waybill records are kept in this folder:

I want the renamed files (with the added invoice numbers) to be saved to

thanks for your help

was wanting a vba code for deleting all Excel files that start with Mentor in a certain folder. Any advice would be great

I must be missing something but I am having trouble trying to write a macro
to delete and Excel file. I have tried the following but does not work......
Application.Workbooks("N:MaintCo-ordMechMaint Day Roster for
Can anyone point me in the right direction.


Where are the Excel Temporary save files located? I have windowes XP and
Microsoft Office Excel 2003

I deleted all old files from my documents folder but all still shows up at
Recent Documents when opening Excel. Any Ideas?

Clip Art Showing as Wav file

I am having aproblem on multiple computers where the clip art images downloaded from the Internet are showing as .wav files.
I have cleared the Temporary Internet Files and temp folder on the hard drive. I have also verified that the image is (for example) and jpeg and the file is supposed to open with Windows Picture and Fax Viewer.
Nothing has worked and I am getting quite frustrated. I have checked the kb that Microsoft has on their web page and did what they mentioned, but we are also not using a proxy so that can't be the issue.
Any information anyone could provide would be great and appreciated!
Thank you

Is it possible to build a mcro that delete sor moves files from one folder to another ?

Thank you


I am using Microsoft XML Reference Schemas in order to develop excel files as xml in Java.
Whenever the XML is incorrect (for example a typo in the tag) I get this message when I open the generated file:

Τhis file cannot be opened because of errors.
Errors are listed in: C:WINDOWSTemporary Internet FilesContent.MSO4184B599.log.

The problem is that if I can't locate this file anywhere in the pc in order to investigate where the issue in the XML is.

Here's what I tried so far:

1. I don't have "Temporary Internet Files" under the Windows folder as the message clearly suggests. I have marked "Show hidden files and folders" in windows explorer but still can't see such a folder.

2. I tried going to C:Documents and Settings<my username>Local SettingsTemporary Internet FilesContent.MSO but this folder is empty (again, I have marked "Show hidden files and folders").

3. I've searched 4184B599.log in all C drive an came up with nothing.

Any idea where these files can be located?

Hi there

Is there a vba code to prevent user deleting an XLS file when the file is closed and the XL app is closed

i.e. simpley prevent deleting the file while it is closed

Since I have upgraded to Office Service PAck 2 for Office 2003, excel has
quite deleting the .tmp files that it creates when you open a spreadsheet.
How can I fix this. I have tried turning off auto save but the setting
changes back each time I edit a new spreadsheet.

When I send linked files through Outlook, the path of the link changes to a
temporary internet file directory - any way to keep the links working

Is it possible to automatically delete an excel file permanently after opening it for a given duration. E.g. Readers are only allowed to open the excel file for 30 minutes, after that the file would automatically be deleted. would really appreciate it if you could provide me with the VBA code as well.. thank you..

Hey Folks,

While coding in VBA, I had been receiving script errors when attempting to utilize the online help from within the VBA IDE.

After fiddling with security settings and much searching for KB Articles as well as Googling newsgroups archives all to no avail, I finally discovered the resolution to this issue.

From within Internet Explorer, under "Tools" and "Internet Options" and "General", run the "Delete Files" under the "Temporary Internet Files" section.

For those of you who have ever experienced the Internet Explorer problem whereby "View" and "Source" does nothing, the above should resolve that issue as well.



Here's the set-up:

"MasterList.csv" is the first workbook opened, and is saved in "My Documents". I get the second .csv file from online. Instead of saving the document, I click the "Open With" option when I download the file, so that it opens directly in Excel without saving (because I frankly don't want to have 200 separate .csv files saved in "My Documents".) The only thing I need from the second document are the entries between A2 and A26. That's it. But when I try to reference the newly opened csv file with "Workbooks(2)", the Macro simply returns the "Subscript out of Range" error, as if the second workbook doesn't exist. To check myself, I opened another workbook that was saved to My Documents, and it recognizes that as "Workbooks(2)" (thus completely skipping over the opened temporary internet file). Is it because it is a temporary internet file that Excel won't recognize it as a workbook? What can I do? Do I really need to save and open all the downloaded csv files for Excel to access them in my macro? I don't believe so... but I've been disappointed before.

Here is my code (which is housed in the "MasterList.csv"). It is my very first attempt at VBA scripting, so I'm sure there is an error or two-- please correct me if necessary.
And THANKS for all your help! You veteran programmers are my role models. o^^o

[B]Sub[/B] entryConcatenator() 
[COLOR=seagreen] '[I]Copy first 25 entries from downloaded CSV file with dynamic (AKA unknown) filename[/I][/COLOR]
Workbooks(2).Worksheets(1).Range("A2:A26").Copy [COLOR=darkred]

No luck finding an answer? You could always try Google.