User To Select Variable Folder For Saving Files

Jun 11, 2009

I would like my macro to prompt the user to select a folder for files to be either opened from or saved to during the running of my macro.

In fact, I need them to select two folders, one for this month and the other for last month.

I think I need to set the two folders as a variable but being fairly new to vba I'm not quite sure how to do this.

View 9 Replies


ADVERTISEMENT

Excel 2003 :: Extract Variable Rows Of Cells From Files In A Folder To Existing File In Folder

Mar 15, 2013

I need a macro in a workbook to look at all the files in the same folder that have "*att*.xls" in the name and determine and copy from the range A15:W515 only the rows that have data in at least columns A, C and D. Each file will vary as to how many rows there will be and there are more than the files with "*att*.xls" in the folder. The data will be on the only worksheet in each file and the worksheet is named "G2WAttendee_xls" the data from all the files need to be copied to the file called "Consolidated webinar reports.xls" (I am using Excel 2003) and to a sheet called "Attendance Data" and added to the end of the last paste.

At the start of the macro the current file "Consolidated webinar report.xls" should be saved to a sub folder of the current directory and have the date saved added to the name. The sub folder is called "Completed reports". The data in the original file on worksheet "Attendance Data" should be deleted.

At the end of the process all the files that have had data copied from them should be moved to the sub folder "Attendance reports consolidated" (This could be done as each file is closed if that is easier).

I have headings in row 1 of the "Attendance Data" worksheet that match the headings in the various files in the folder (which will always be in row 14 of the individual "*att*.xls" files).

The folder with all the files and the "Consolidated webinar report.xls" file is at path "Z:P and S MEvaluationsWebinar series 2012-13TB".

View 9 Replies View Related

Saving Attached Files From Outlook To Folder

Mar 3, 2013

I'm programing a VBA macro in Outlook 2007. I have added a button to the quick bar so when i open an email and push that button, a Excel file opens and i can input some data. Thing is, i need that if the opened email have some kind of attachment, when i push the button i want this attachement to be saved into a specific folder. Is that posssible?

View 2 Replies View Related

Prompt User For Folder, Import All Text Files & Replace In Range

Sep 2, 2009

Split From Run VBA Macro From Another Procedure. will it autosave and open all the archives in the file i specify and loop?

View 3 Replies View Related

Prevent The User From Saving The Data Input From The User Form If Any Of Those Three Fields Is Left Blank

Feb 9, 2010

I have a user form that has a combo box "City" two text boxes one called "Flight" and the other "Date". What I'm trying to do is to prevent the user from saving the data input from the user form if any of those three fields is left blank. The code that I have so far checks all of the required fields, if any are left blank a message notifys which field(s) is left blank and return the focus back to that field. But the rest of code also fires.

What I really need is either to stop the code if any fields are blank and return the focus back to the blank field, the user completes the field(s) and clicks the save again, or better yet, pause the code until all the required fields are completed and then complete the save. (There is actually another 200+ lines of code in this sub, but I deleted it to keep the post a little shorter.)

View 2 Replies View Related

Saving Comma Separated .txt Files As .csv Files

Sep 15, 2009

I have a large number of .txt files that are comma separated files (but not saved with the .csv extension) that I need to convert to files with the .csv extension.

Is there an easy way to do this for all files in a given folder? Ideally, the files don't even need to be opened as they are are quite large in size (70MB+) and there are a lot of them (500+).

View 9 Replies View Related

Open Files In Folder- Wait 30 Seconds Then Close The Files

Jul 5, 2007

I want to allow users to place files (.jpg, .tif, .pdf, .pps etc) into a network folder and then have my program open each file and display it for 30 seconds then close the file and the application before opening the next file.

1. Set up a loop to get a directory listing of the folder and write the listing to a text file.

2. Open up the text file and get the next filename in it

3. Open the file in the associated application

4. Wait for 30 seconds (or some period of time) and then close the file

5. Repeat steps 2-4

DoIt = 1
While DoIt = 1
Open "C:TempList.txt" for output as #1
Print #1, Files In Folder
Close #1

Open "C:TempList.txt" for input as #2
while not eof(2)
Line input #2, MyFile
Display MyFile on screen
Wait for 30 seconds
Close MyFile and MyApplication that opened it
wend
Close #2

I can get the directory listing just fine with no problems

I can open the files in the associated application just fine with no problems.

with closing the application after 30 seconds or some period of time.

I need some code that will allow me to easily send it a filename and it will know how to close the file and the application that opened it.

View 9 Replies View Related

Files Saved To Program Files Folder, Open As Read Only

Feb 8, 2009

I have an Excel application (Excel 2003) which is stored in the default Program Files folder by the Installer; for example: c:program fileszxchello.xls. The problem I am running into is this file opens as Read Only in Vista and this is interfering with the running of the application. There is no problem opening the file normally in Windows XP.

I have been able to narrow down the cause of this to the User Account Control system in Vista - if I turn OFF User Account Control, the Excel file opens normally and my application functions normally. Is there another option to open the Excel file without turning OFF User Account Control because some users may find it unacceptable to turn OFF this security feature. Ofcourse, one option is to install the application in another location, outside the Program Folder, and the file would open normally, but the Packaging Wizard that I am using to package the application does not allow me to install the application in any other location and thus, the application installs in the Program Folder and I am running into this problem of the Exel file opening as Read Only. Is there a way out of this situation where I can open the file normally (not as Read Only)?

View 5 Replies View Related

Saving User Inputted Data From A Worksheet To Another Worksheet And Saving It

Jan 7, 2009

I have created a form in a worksheet which I have added questions too and then locked all cells except the ones where I want the answers in.

I have then added a button to the bottom of the sheet called "Print and Save". This work sheet is called "form"

On a second sheet called "database", I have all the titles of the questions running from a -> k and nother else.

What I want to happen is the user input the information on "form" into the boxes available. Once they have completed the questions, I want them to be able to click on "Print and Save" so that firstly the page "form" prints, and then for all of the answers to be saved in "database" below the titles for each question.

I have had a play, but just don't know where to start. Also, once there is a row of questions below the titles, I don't want it to overwrite information already there, it needs to go onto the next empty row available.

Attached is my excel file.

You will see in the code that I have the code for printing.. I just found this on the net and it seems to work fine for me.

View 9 Replies View Related

Convert All CSV Files In A Folder To Excel Files?

Apr 8, 2014

I is it possible to convert all comma separated text files in a single folder in to excel files. But the requirement is to have 2 sheets in each new file. first to be the full file - with all columns, and in the second sheet to keep only colum A B D G H K L M O P R S T V W from the first sheet. The second sheet name must be the same as the first one but without the first "wlist_" in the name.

One more thing. The third column in the second is called "COUL". there are short letters for colors in french

can they be converted with the sort in English like it goes:

NO = B
BA = W
RG = R
SO = P
JA = Y
BE = L
VE = GY
GR = G
VI = V
MA = BR
BJ = TA
OR = O

Here is a link to the both CSV and an example excel file with the end result. In this example i haven`t change the shorts for the colors. It takes me too much time with the find and replace function. And at the moment i`m really pushed from time.

[URL]

View 9 Replies View Related

Saving CSV File And Sending To A Folder Over And Over Again

Jan 12, 2009

I have this code

View 10 Replies View Related

Macro Saving To Wrong Folder?

Jan 10, 2012

I have a macro that saves the workbook after it has finsihed the rest of its formatting. I am finding it is saving in the wrong folder. I looked at my code and it is clearly states 'my documents' where I want it to save. Yet it keeps saving on a random folder on a shared drive.

View 8 Replies View Related

Saving An Unopened Workbook In A New Folder

Feb 14, 2007

I would like to copy a workbook from one folder to another without opening the original. Obviously, tempname.SaveCopyAs doesn't work, can you suggest an alternative?

Sub gettemplate()
Dim tempname, tempcopy As String

tempname = Application. GetOpenFilename 'Choose the path of the original workbook
tempcopy = Application.GetSaveAsFilename 'Choose the path where the copy will be saved
tempname.SaveCopyAs tempcopy 'Want to save the original workbook into the copy file path
Workbooks.Open tempname 'Open the copy

End Sub

View 4 Replies View Related

Determine If Folder Exists Before Saving

Mar 29, 2008

I'm sure this will be an easy question, but I've been searching for awhile and can't seem to find an answer. I'm trying to write code in VBA that will check if a directory within c:documents and settings...my documents exists, and then save a file to that directory. The problem is, I'm having trouble finding the my documents directory. Is there some object or property that I could use to find the my documents path? Note that the worksheet that I'll be working with is in a separate directory, and therefore neither activeworkbook.path nor thisworkbook.path would be an option.

View 3 Replies View Related

VBA Saving Copy Of Single Worksheet To Different Folder?

Oct 26, 2012

I currently have a application that people fill out on a userform. When they click on a command button at the end it puts all that information on a sheet i made and then we print it off. My objective is when it saves it to the sheet it also save a copy of that paticular sheet in a seperate location such as H:/applications. Also the copy should be renamed to the information thats in a specific cell Such as j4 the have this text added after that "Application"..

View 4 Replies View Related

Creating A Folder And Saving In It With A Filename Taken From Cell

Mar 21, 2009

I would like excel to create the folder C:/Bill if it doesn't already exist when I click save/save as option and save the workbook in it with a filename that is a combination of text/values in cells A1 and A2 on Sheet1. Better if the save as dialog box appears with this option selected so that I have to just click Save in the save as dialog box to save it in "C:/Bill".

View 9 Replies View Related

Saving File To A Specific Folder In A Server

May 22, 2009

I have a macro which saves file to a specific folder. Problem is I can save the file only in my local drive C: but not on a server for some reason.
Here is the
At home in my home computer this code worked when C: was selected.

ChDir ("c:")
Title = Application.GetSaveAsFilename(Name, "Excel files (*.xls), *.xls")
ActiveWorkbook.SaveAs Name
Save the file in specific place

But when I substituted C: path with my server path it doesnt work! Have a look. Its the exact same code except my path is different.


ChDir ("\Lnf001Lnf1vol1SharedOP_ENGWork Order")
Title = Application.GetSaveAsFilename(Name, "Excel files (*.xls), *.xls")
ActiveWorkbook.SaveAs Name

View 9 Replies View Related

Stopping User Saving Unless Condition Met.

Mar 6, 2008

I am looking to stop the user saving the sheet if certain fields are not complete.

The sheet has headers on line 4 and runs from A4 to M500

In the M cells there is a counta function to check the records are complete.

M4:M500 shows either

Complete - All records comlpete
Incomplete - something missing
Blank - nothing entered yet.

What i want to do is, if one of the cells in M shows incomplete not allow them to save the sheet until its complete.

I tried the folowing (was my attempt to modify another post)

View 10 Replies View Related

Saving User Based Data?

Jan 1, 2014

I am working on a project in which I used a formula and created a kind of a software.what I need to do is that after my user enters certain data it is sent to a worksheet(as directed).now I want that data to remain saved there even when I am changing the inputs in the formula. what is happening is that my previous data is getting erased when I enter new variables to the formula .

View 1 Replies View Related

Preventing A User From Saving A Workbook

Apr 10, 2008

if it is possible to prevent a workbook from being saved other than by a macro (So no saves on Ctrl + S or File Saves). Basically, I want to allow users to use a template that I have set up, but I do not want to allow them to be able to save the document.

View 9 Replies View Related

VBA Saving PDF Files Into Folders

Sep 29, 2013

I have this code that generates excel pages as pdf files, but I can't get it to save it in its individual folders. For example, I have the sheet name as Brian Lin, I want to save the pdf into the folder called Brian Lin, then if I have the sheet name as Lilly Tran, the pdf should save into the folder called Lilly Tran. Here's my code. The code is one step short of what I want it to do, it saves in the folder right before the name folders.

Code:

Sub Macro1()
Dim wsh As Worksheet, vWshs
Dim sFolderName As String, set_Path As String, name As String, hwas As String, sname As String, swsname As String
vWshs = Array("Rates", "Inputs")
set_Path = "C:UsersJonathanDesktopFaFundInvoices" & hwas & ""

[Code]...

View 4 Replies View Related

Search Folder For Files Containing "Temp", Delete Files

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

Append Variable In Variable Select Case Method

Feb 16, 2012

I want the select case list of a ComboBox to be treated as a variable in order to shorten the code size. To clarify the problem, i post the code with what i want to do, but don't know how to do it that way.

Code:

Select Case ComboBox1.ListIndex
Case 0: y = "AT"
For j = 0 To 26
Case "j": y = sheets("name").Range("A(j)") 'Range A(j) is a string, so y as well, as seen in Case 0.
Next j
End Select

Is something like this possible?

View 3 Replies View Related

Saving Causes Backup Files To Form?

Apr 19, 2013

Whenever I make a change to any of my spreadsheets and click save, a backup is created in the same folder. A sample document is attached. Download it, make a change, then save it.

View 3 Replies View Related

Excel 2010 :: Saving To TXT Files?

Nov 23, 2011

I'm saving information from excel 2010 in to a text file (txt), when doing this and opening up the txt file the below line is saving it with " at the start and at the end of the line.

:32A:110809GBP4,00

Is there any way when saving as a text file without the " pulling through at the start and at the end of the line?

View 2 Replies View Related

Saving Batch Files From Excel

Nov 22, 2013

I currently have 3 batch files that I would like to be able to update using VBA instead of manually adding the information to each one. My goal is to be able to use my excel file and when I add new lines I could then run the script to save and/or update each of the batch files. I would like to be able to add the new lines I added in excel to the end of the batch files. I use the batch files for automation purposes but I do not like the fact that I have to open each one and added the same lines three times. This is why I want to be able to update my excel file and then add those new lines to the batch file. An example of how to accomplish this task using VBA would be awesome.

View 2 Replies View Related

Copying Tabs And Saving Them As Files

Jun 13, 2007

I've already done a search and found this on ozgrid.com:

RunCodeOnAllXLSFiles

I'm sure it is what I need, but as a non-programmer, I'm having trouble using it.

I have 12 files, each with 14 tabs. Example:

File: Sector.xls
Tab 1: Region 1
Tab 2: Region 2
Tab 3: Region 3

The client now wants 14 files, each with 12 tabs:

File: Region 1.xls
Tab 1: Sector 1
Tab 2: Sector 2
Tab 3: Sector 3

My first attempt was to try a macro:

1) left click on tab
2) move or copy...
3) move selected sheets to book (File: Region 1.xls)
4) then go on to next tab...............

Now, this does loop through the requested files, I can see them open, then close. I'm guessing they are copying, but I take it that I need to have it paste, then go to the next? (The c:files is just generic, as the files are on our LAN, and I'm just paranoid. The "Erie St. Clair" are the actual names of the file, and the tabs).

View 2 Replies View Related

Template Excel File - Stop User From Saving

Oct 3, 2008

I have a template excel file that is loaded with macros. When the file is opened, a userform opens and the user makes several different selections. Based on the selections, the excel file is populated with information and pictures. I want to make sure that the user does not accidentally save over the template file when he/she is finished with the document.

My original solution was: when the user opened the excel file, it would automatically save under a different name in a temporary location. This would stop the user from being able to overwrite the source file. The users were not happy because the excel file is very large and takes a long time to save.

on another method to stop the user from overwriting the source file? using code? or another method?

View 9 Replies View Related

User Forms Saving Items Entered To Memory

Feb 16, 2010

Is there a way to save items into memory to be recalled in userforms.

Let's assume that I have a userform called UserForm1 and three textboxes named TextBox1, TextBox2 and TextBox3.

View 9 Replies View Related

Keep Sheet Names Unchanged After Saving Them As TXT Files

Mar 24, 2014

I want two sheets of my Excel workbook to be saved as txt file. The name of the file is compiled of a fixed part ("TrialList" or "BlockList") and two values from another sheet (subject and session number):

[Code] ........

Now, saving the text files with the desired file names works perfectly. However, Excel decides to change the names of the sheets that have been saved as text files accordingly. This is something I want to prevent from happening, since a second loop of actions will end because of the unexpected sheet names...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved