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
ADVERTISEMENT
Sep 25, 2006
I have the following code which saves my worksheet with a name extracted from particular cells:
Public Sub SaveAsMaximoWO()
ThisFile = Range("AC5").Value
ThisFile2 = Range("E3").Value
saveName = ThisFile & " - " & ThisFile2
ActiveWorkbook.SaveAs Filename:=saveName
End Sub
This (for reasons I don't understand) saves the file to My Documents by default.
What I would like it to do is save to another folder within my documents as default.
View 14 Replies
View Related
Jan 12, 2009
I have this code
View 10 Replies
View Related
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
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
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
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
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
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
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
View Related
Jan 30, 2003
I have a spreadsheet that imports data, manipulates it then deletes 2 of the sheets then saves the file under a different name to the network. Is there any way to save this new worksheet without it storing the macros - so when the user open it, only the data is there and they get no prompt to enable macros?
View 6 Replies
View Related
Apr 13, 2009
looking for some code to save to a destination
destination address is
C:Documents and SettingsstDesktopOJF
now the problem is OJF has folders named 1 to 500
so if cell d5 = 487 it will need to look in the above desination and then open the folder and save it there.
View 10 Replies
View Related
Aug 19, 2013
This macro has a problem in that it totals up the colunmns in two places by error
The total should be at the end of the coumns only.
It gives me a total part way through the list which muddles things up a bit.
Sub prepareSAPexport()
'
' prepareSAPexport Macro
' prepare the sap export ready to be compared to CDS
'
' Keyboard Shortcut: Ctrl+s
'
Range("A1").Select
[code]....
View 1 Replies
View Related
Jul 11, 2008
I have a userform which is designed to get and enter data into one worksheet.
When I call the userform up from a different worksheet it doesnt refer back to the data source worksheet?? How can I do this?
I have used
sheets("dataworksheet").activate
in the user form initialise event but this still doesnt work.
View 9 Replies
View Related
Mar 30, 2014
[Code] ....
But it doesn't show the correct sheet after running it.
I need it to show the sheet called "Invoice with code".
View 3 Replies
View Related
Jun 6, 2009
The below code is supposed to delete data on the last sheet of the workbook HeadsetOutTimeMay.xls however for some reason it is deleting the data on HeadsetOutTime.xls What am I doing wrong?
View 8 Replies
View Related
Jul 29, 2009
I have a macro on a particular workbook that runs when the workbook closes.
This runs fine when I close the workbook itself. If I happen to have other workbooks open and then I close EXCEL rather than an individual workbook, my macro that runs on close always runs when it is not the active workbook.
To put it another way, say that my 'run on close' macro is workbook 1. I also have workbooks 2 and 3 open as well. If workbook 3 is the active workbook and I choose to close Excel (and thus close all three workbooks), my 'run on close' macro runs straight away and, worse still, will run it on workbook 3 (my active workbook).
How can I stop the macro running until it is the active workbook in the closing chain, so that it only runs on the correct workbook? (workbook 1 in my example)
View 9 Replies
View Related
Jun 22, 2006
I have this macro
For I = 6 To 18
Sheets(I).Visible = xlSheetVisible
PrintSubs Sheets(I)
Sheets(I).Visible = xlSheetVeryHidden
Next
End Sub
When it starts printing it starts off with my "JOBCOM" sheet which is sheet20. why it would start printing with that one. That sheet shouldn't even print at all. It's only supposed to print sheets6 to sheet18.
View 9 Replies
View Related
Mar 10, 2014
The below code is giving wrong error.
[Code] ........
sheet1 has the following data
sheet1 has the following data
empid name loc
1 aaaa ddd
2 bbbb ggg
4 cccc dddd
the 3rd row is empty in sheet1 but still it is showing number of rows as 3.I need macro it will not count if entire row is empty in that sheet.
View 14 Replies
View Related
Apr 27, 2009
I'm exporting a csv file from a membership database with the attendance of members. With a macro i open the file and copy the contend to excel. With the macro the column for the date has *randomly* wrong formats. Example the date in column B:
Aasia Tallah19-03-2009 19:33
Aasia Tallah17/03/09 7:49 pm
Aasia Tallah15/03/09 7:53 pm
Aasia Tallah14/03/09 6:34 pm
Aasia Tallah03-12-2009 20:05
Aasia Tallah03-11-2009 19:56
Aasia Tallah03-10-2009 19:54
I try to change the format of the column, but that does not work. Rows 2,3 and 4 seem to be text but they are not. If i access the edit bar for example the 17th of march and store without changing anything, it changes to the format of the first row. That is how i want it. If i copy the column by hand, every thing is fine.
All of the following i tryed:
- format date column of the csv before copying... failed
- copy special with only pasting values... failed
- preformat the column i paste the date to... failed
- delete the sheet i paste to and create a new one... failed
- copy the macro to a new workbook... failed
View 2 Replies
View Related
Sep 3, 2009
When running a macro is there a way you can execute code on another sheet within a workbook without being in the original sheet?
I seem to have a problem if I accidentally run a macro not on the original sheet whereby the code is executed and fills over data not in the desired sheet and the previous cells information is lost and the only way to fix the problem is to close the workbook and re-open a saved copy as you can't undo?
View 9 Replies
View Related
Jun 17, 2012
I have a group of Excel (2003) template files, each with a different name. When these files are opened they ask for certain information and save themselves as a unique name. Within these files are VBA routines and functions and, because these files basically do the same things, they have the same name. These routines exist in their own unique modules each with a different name. Unfortunately, in these files there are differences in the number of columns of information these routines act on so once they have been saved I need them to only act on their own columns only.
My problem is, when I have more than 1 of these files open in the same instance of Excel, I try to run a file using a control letter combination Ctrl-e and it sometimes runs the version of the macro in the wrong file. This leads to all kinds of strange thing happening. What I can do to force the correct macro to work in all instances?
View 2 Replies
View Related
Jan 3, 2008
Could anyone tell me if it is possible to get a file to save as follows:
filepathfolder called "YYYY"folder called "MMM"File.xls
where YYYY is the year and MMM is the month?
The folders YYYY and MMM may or may not exist. Is it possible to get excel to create them if they do not already exist?
View 10 Replies
View Related
Nov 6, 2011
I use Excel 2003 at work. I'm looking for some code that will Open a folder and then lets the user to select a file then continues to run the macro.
The file name they select will look similar to this K2271011.504 or K3011111.201
View 3 Replies
View Related
Dec 8, 2008
How do I save the spreadsheet with the current name of the spreadsheet in a macro?
Example:
I want to save the spreadsheet to a network drive using the current name of the spreadsheet (it changes every other day). But I dont know to put the name in the SAVE statement. Here is what I have now:
View 4 Replies
View Related
Mar 14, 2007
Prevent saving and allow only through Macro
I am contracting an excel template and need to stop users saving the file using “Save” or “Save As”. I am able to do this by using the private sub below:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
End Sub
I also understand that by switching to “Designer” mode you can save the file and once re opened designer mode will be switched off. What I need is to allow saving using a macro, is there a code that I can insert in the macro to switch designer mode?
View 9 Replies
View Related
Dec 24, 2007
I Want A Code That Will Save My Workbook To A Specific File (different Form The One It Is Currently In) Using The Name That I Have Typed In Cell D13 In The Workbook
View 9 Replies
View Related
Sep 4, 2009
I have this analyze that is runned by a macro in one workbook, and it starts a analyzing-process in another workbook. The data is picked up in the no2 book, and returned to the first book. It is analyzing lots of workbooks, sometimes up to 1000 workbooks, it means that no2 workbook gets a new name and then saved.
I have once heard that the process could be way faster if the workbooks where the analyzes is processed through not were saved, and I actually dont need the books as long as I got the data into my first workbook.
But Im not sure what in the macro that makes it save the no2 workbook, but I would really like to speed up this process. As it is now I have to start the analyze before I go to bed, and the hopefully it's done when I wake up next morning.
View 9 Replies
View Related
Feb 6, 2008
i have a worksheet named for example 'allocation 1' this is a master document and is opened and modified and 'saved as' under a customer name. This then stops a few important macros working properly because they refer to the original title and not the new saved title. Is there any code that will let the macro recognise any new title it is saved under?
View 10 Replies
View Related
Nov 15, 2008
Thanks for all the help so far with this issue. I seem to be getting errors after running a macro a second time. The name of the cell range is changing. I have attached the spreadsheet and I will try to be specific as possible.
Goal 1: I need to input monthly data into the Sales tab and then save it as a CSV file.
Goal 2: Re-open original xls file that has data then Run macro to create reports.
Goal 3: Save Original xls file as a clean sheet to use again next month.
Process:
1 - Insert Data into Sales tab
2 - File/Save As a CSV (Now the CSV file is open)
3 - Close CSV file and re-open the original xls file
4 - Run Macro to create reports
5 - Print Reports
6 - Manually delete current data on all tabs so I have a clean sheet for next month
7 - Save and Close
Problem:
When I open the xls file (next month) to input new data and run the reports I get a Run Time Error '1004" The Pivot Table field Name is Not Valid
I found that the Named Range of cells changed from the original:
View 8 Replies
View Related