Unzip Then Delete Or Overwrite Files
Aug 21, 2010
I've struggled to find the code to unzip files using VBA but I finally found it and it works (using Shell).
The problem is that I want to unzip all zip files in a folder but my zip files contain 3 files:
1 csv file that I want to keep and 1 xml and 1 txt file that I want to delete.
I can't just unzip everything and deal with the txt and xml later because the xml and txt files all have the same name. So if I don't do anything, I have a series of overwriting messages prompting me to click yes or no. So what I want is either to delete xml and txt one by one after they are created or get rid of the overwriting prompt. I've tried to put a kill or delete file just after the unzip command but it doesn't work - it's telling me that the txt file doesn't exist (should I add some sort of refreshing command ?) and I couldn't find anything on google about overwriting text or xml files.
View 5 Replies
ADVERTISEMENT
Aug 21, 2005
Is there a way from excel that i could unzip files then rename those files and then rezip these files to the original zip file using a macro?
View 9 Replies
View Related
Dec 7, 2007
Does anyone have a way to make Excel Zip and/or Unzip Files using only Windows Native Functionality?
I know I can use command line zip utilities like Winzip or Winrar. But I'm trying to make some scripts that will be shared among other users, and would like to NOT require users to install extra software to make it work.
I know windows has the built in capability to zip unzip files through the windows GUI, so there must be a way to do it with command lines from VBA code...
P.S. At the moment I am mostly concerned with UNzipping.
View 9 Replies
View Related
Jul 7, 2006
I'm using:- Open "file name" For Input As #1 to read and manipulate files. However, I've hit a problem with how to open and read zipped files (winrar).
View 3 Replies
View Related
Nov 7, 2011
I have code with downloads files from our work intranet site. When the files download the are zipped up. Is there a code which will unzip and open these excel files?
I'm using Excel 2003.
View 2 Replies
View Related
Aug 4, 2012
I'm trying to automate unzipping many .gz files on a monthly basis. Previously I used a macro a coworker wrote to do the unzipping using winzip (think he may have used some code snippets from this forum for it - seems like several sites have similar code shown in different postings). But now my office has switched over to pkware's SecureZIP, I can no longer use winzip, and my coworker has moved on. Can I manipulate that old code to work with SecureZIP somehow?
View 1 Replies
View Related
Aug 8, 2014
I have a macro that saves zip files automatically from outlook every day and saves over those zip files (which I want). But now I need to unzip those files and save their csv files in a different folder. I will be saving over the same csv files everyday.
(I have 5 zip files saved and named and each file contains just 1 csv file)
I have had a look at Ron de Bruin's code but he requires you to open the and search for the zip file. I would like this to unzip and save automatically without having to use "Application.Getopen".
View 1 Replies
View Related
Jun 26, 2008
Is there a code that will search a pre-determined folder for all .xls files containing the word "Temp", and deleting those files?
Example:
In the root of drive M, I have several Excel files. Anytime one of the original tracking logs is opened, a temp file of that log is automatically created. I would like to automatically search the drive and delete all files containin the word "Temp".
I've attached a picture of the directory tree, in case that will help. The file will always be named "PO Response Tracking - Temp#######.xls", with ###### representing a series of either 5 or 6 numbers.
View 14 Replies
View Related
Jun 29, 2006
I want to search a particular folder & delete certain files. I'm using the code below.
Sub test()
With Application.FileSearch
.NewSearch
'The folder where my files are located
.LookIn = "C:Documents and SettingscDesktop"
.SearchSubFolders = False
'Search text in any type of files
.Filename = "*.htm"
View 3 Replies
View Related
Feb 26, 2007
I need a macro to delete all files with defined extension in defined folder.
For ex. I have a folder named "pictures" filled with pictures in jpg bmp gif etc. formats. But i need only bmp files to be deleted
View 6 Replies
View Related
Oct 19, 2009
I use some VBA that does many things and in the end it exports the files to a network drive and as a last step, it creates a Log, the log is basically one row for each file exported which includes the path and file, something like this:
Row 1: Headers...
Row 2: \networkpath odrivefolderDocument_file_name.xls
Row 3: \networkpath odrivefolderDocument_file_name2.xls
Row 4: \networkpath odrivefolderDocument_file_name3.xls
So, basically looking for a way to start at row 2 to end, and delete the files. Looking for a way to also maybe save/and archive them on my local Desktop on XP ?
View 9 Replies
View Related
Sep 6, 2007
I m trying to delete all files in a specific folder?
View 5 Replies
View Related
Apr 25, 2006
I have this piece of code which copies module1 from file1 to all other open files which I list below open.
I want to modify it so that it will delete module11 as it goes.
Dim FName As String
Dim FName1 As String
With Workbooks("CFADS01") 'copies from here
FName = .Path & "code.txt"
.VBProject.VBComponents("Module1").Export FName
End With
'copies into these workbooks
'all workbooks need to be open
Workbooks("CFADS01").VBProject.VBComponents. Import FName
Workbooks("CFADS02").VBProject.VBComponents.Import FName
View 9 Replies
View Related
Dec 6, 2006
I have several organized folders which contain contain, in total, hundreads of files all created from the same master file. The Master file contains several macros used to sort and organize data copied from our engineering database (web-based).
After a file is created the macro is no longer needed. I am looking for some direction on how to go about opening and saving the files which are located on a network drive.
I have found some good starting point here for the actual removal, and I am working on a new master file which doesn't keep the macro when saved (save as...).
View 9 Replies
View Related
Jun 6, 2008
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.
View 5 Replies
View Related
Sep 8, 2009
i would like to be able to move files from one folder to another then delete the original files.
I dont think im passsing the variables to the functions corectly.
View 8 Replies
View Related
Jul 2, 2014
Say I have a list in column A
Image1.jpg
Image2.jpg
Image3.jpg
Image4.jpg
Image5.jpg
In VBA, how can I loop through the list and delete files from a certain folder. The list will vary in length from time to time.
View 9 Replies
View Related
Aug 22, 2006
Right now the security settings on my server are set so that new files can be added by anyone but only a few people can delete them. Everytime Excel opens a file on the server it creates a temp file that it cannot delete due to the security settings. This means that I have to go in to each subdirectory and manually select then delete each of these temp files.
way to identify an excel tempfile, or a method for deleting these files with VBA?
View 9 Replies
View Related
Oct 25, 2006
i am importing a large number of text files from a folder into an excel worksheet (into column A) and found the following code from searching the forum.
Sub Import_Text_Files()
Const PATH = "C:Documents and SettingsSilent BazMy DocumentsElectronic Gift Card WorkTestTextFolder"
Dim My_Filenumber As Integer
Dim My_File As String
Dim My_Data As String
My_File = Trim(Dir(PATH))
If My_File = "" Then
MsgBox "No Files found matching " & PATH & My_Extension
Exit Sub
End If.......
View 9 Replies
View Related
Apr 9, 2008
I was trying to use Sheet1 (data input sheet) to collect 33 values and write them to Sheet2 as a row. I wanted the user to be able to make changes/corrections. So if the set of data with same date and shift number is entered for a second time, my macro should be able to over-write the existing row in Sheet2. Have been digging for days yet with no avail.
I'm using Win XP pro and Excel 2003.
View 9 Replies
View Related
Feb 8, 2008
Just wondering if it is possible to have a formula in a cell but over write it with other digits while preserving the underlying formula?
I can lock the sheet/workbook but cant edit the cells once this is done?
I'm hoping to be able to delete what ever I have overwritten and for the formula to then take effect again.
View 11 Replies
View Related
May 27, 2014
I am trying to create a macro which copies the data of one column every time I click on it. However, every time I click on it I overwrite the data I already copied. What do I have to do, that instead of overwriting my data it copies it to the next free column.
See example attached. Macro example.xlsx
View 2 Replies
View Related
Jun 18, 2009
if i run my macro that saves a sheet as a certain name and then prints it, it works, but if i run my macro and the file already exists it asks me to overwrite it. If i select yes it prints it and carrys on with the rest of the macro, (good). If i select no the macro fails. How can i get it so if i hit no, it runs the rest of the macro after the print command?
View 2 Replies
View Related
Oct 22, 2007
I am trying to set up a macro in excel that will include a save as. This should overwrite an old file. The problem is that I can't get the macro to overwrite. Instead the popup "Do you want to overwrite?" appears and I have to click "OK" manually. Can this be done automaticaly? What is the VB code for it?
View 9 Replies
View Related
Aug 17, 2008
in cell A1 i have the balance. i would like to record the balance every time it reaches a new high in cell B1. how would this be possible please using excel 2007
View 9 Replies
View Related
Mar 9, 2009
Column A (Plan Date) and Column B (Date Recieved) contain date value. If B2 is blank, A2 will maintain the date entered in it. However if B2 has date (either earlier or later than A2) it will supersede the date with the date value in B2.
View 9 Replies
View Related
Apr 24, 2009
I've just written a bit of looping vba script that generates an overwrite alert (i.e. "Output range will overwrite existing data. Press OK to overwrite..."). This is fine and was purposely built into the script, but I want to be able to automatically ignore these alerts and loop through the script unhindered.
View 4 Replies
View Related
Nov 26, 2009
I have the following code which copies a sheet to another workbook and renames it with the current date. However I need it to check if there is a sheet already existing in the other workbook with todays date first. If there is then it should delete the old sheet and copy the new sheet or just overwrite it.
View 4 Replies
View Related
Apr 2, 2012
Is it possible to overwrite an existing .csv file with
The command :
ActiveWorkbook.SaveAs FileName:=fName, FileFormat:=xlCSV
Or does it need to be Killed first ?
Plus do I need any of the options such as Create Backup, AccessMode As etc.
View 1 Replies
View Related
Apr 18, 2012
I would like to code a Userform Command button to save data by overwriting a specific row of data. The specific row is to be based on data matching in column A and column B. I'll give an example
Worksheet = "Failures"
Row 1 - Column A - Column B - Value
Row 2 - 12/3/2012 - FOX ------ 23
Row 3 - 12/3/2012 - CEF ------ 24
Row 4 - 12/3/2012 - COT ------ 23
Row 5 - 13/3/2012 - FOX ------ 56
Row 6 - 13/3/2012 - COT ------ 23
Row 7 - 14/3/2012 - FOX ------ 26
I would like the code that would search for the specific row (e.g Row 5 discovered by searching for 13/3/2012 and FOX) in the "Failures" Worksheet and then overwrite it with the following data values from a Userform called "QC"
(TextBox1) (TextBox2) (TextBox3)
13/3/2012 --- FOX -------- 24
View 1 Replies
View Related