Macro - File Save As

I have 7 identical files which I routinely save to another drive and remove the links.  I've recorded a macro that will move the files, but I have to edit it each time to adjust the name of the file.  Can the macro be adjusted to move the active file instead of specifying the name of the file?  Here's the macro as I currently have it recorded: (This is MPA Attorney, but I would save MPA Agency next, then MPA Internal, etc..

ActiveWorkbook.SaveAs Filename:= 
        "I:\EXLDATA\Loan Recovery MIS\2004_03\Outstandings\MPA Attorney.xls", 
        FileFormat:=xlNormal, Password:="", WriteResPassword:="", 
        ReadOnlyRecommended:=False, CreateBackup:=Fals
    Sheets(Array("All Roll-up", "PEL_Rev Summary", "AF DFS Summary", "ARP", 
        "Auto Finance", "BCS", "Commercial", "DDA", "DFS", "Direct", "FUHEB", "FUMC", "HEL", 
        "Lease", "TMS", "TMS-PEL", "W&T", "Revolving", "PEL")).Selec
    Sheets("All Roll-up").Activat
    Cells.Selec
    Selection.Cop
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= 
        False, Transpose:=Fals
    Range("B3").Selec
    Sheets("All Roll-up").Selec
End Sub
0
anonymous (74717)
4/7/2004 2:31:02 PM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
412 Views

Similar Articles

[PageSpeed] 37

So you want to save the file into a different folder, but with the same
filename?

If yes:

    Dim myFileName As String   
    myFileName = ActiveWorkbook.Name
    ActiveWorkbook.SaveAs Filename:= _
        "I:\EXLDATA\Loan Recovery MIS\2004_03\Outstandings\" & myFileName, _
        FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
        ReadOnlyRecommended:=False, CreateBackup:=False

If you really meant you want to save it in place (overwrite the original), then
you could do your save (not .saveas), then close it.

Then look a Name in VBA's help to move it to that other location.

VBA also has a FileCopy that can copy a file (not an open workbook) to a new
location.

Stephanie wrote:
> 
> I have 7 identical files which I routinely save to another drive and remove the links.  I've recorded a macro that will move the files, but I have to edit it each time to adjust the name of the file.  Can the macro be adjusted to move the active file instead of specifying the name of the file?  Here's the macro as I currently have it recorded: (This is MPA Attorney, but I would save MPA Agency next, then MPA Internal, etc...
> 
> ActiveWorkbook.SaveAs Filename:= _
>         "I:\EXLDATA\Loan Recovery MIS\2004_03\Outstandings\MPA Attorney.xls", _
>         FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
>         ReadOnlyRecommended:=False, CreateBackup:=False
>     Sheets(Array("All Roll-up", "PEL_Rev Summary", "AF DFS Summary", "ARP", _
>         "Auto Finance", "BCS", "Commercial", "DDA", "DFS", "Direct", "FUHEB", "FUMC", "HEL", _
>         "Lease", "TMS", "TMS-PEL", "W&T", "Revolving", "PEL")).Select
>     Sheets("All Roll-up").Activate
>     Cells.Select
>     Selection.Copy
>     Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
>         False, Transpose:=False
>     Range("B3").Select
>     Sheets("All Roll-up").Select
> End Sub

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
4/7/2004 11:36:18 PM
Watch your double quotes.

"I:\EXLDATA\Loan Recovery MIS\2004_03\Outstandings\" & myFileName, _

Notice that the & myfilename isn't within the double quotes in this example.

Stephanie wrote:
> 
> This changed my file name to
> 
> & myFileName
> 
> ?????

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
4/8/2004 10:55:14 PM
Reply:

Similar Artilces:

Macro warning with no macros
I have a workbook that when I try to open it I get the warning tellin me it contains macros and asking whether I want to Enable or Disabl them. I put no macros, no VB scripts, nothing at all in the workboo other than standard Excel formulas and some charts. I developed it i Excel 2002, SP-2, but have moved it back and forth between tw computers, the other which has Excel 97. Regardless of whether Enable or Disable or change the security settings so as not to get th warning, once the workbook is open even if I go t Tools-Macro-Macros... it lists no macros. How can I find out what's cau...

saving the history of recently used excel documentsto another comp
Reimaging a computer and wanting to know if I can export the excel history to the new image. Most files are on the network and not sure where they are, don't want to remap them all If you're referring to the files listed at the bottom of the File menu you'd have to run the Regedit program and go to this key: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Recent Files replacing the "11.0" with your Excel version if different. Then you would have to right click on the Recent Files folder and Export it. After the reimage you would double-click the resultin...

When changing end time in appointment crm cannot save duration
Hello all When we started running the crm with https instead of http the following error appeared: When you change the end time of an appointment, CRM cannot save the change to duration. Error message: "Microsoft CRM was unable to save the change to duration. Try changing the duration value again." Any ideas? Regards Magnus Also, the error is only surfacing in the web client. /Magnus "Magnus Olsson" wrote: > Hello all > > When we started running the crm with https instead of http the following > error appeared: When you change the end time of an app...

Where do I find "save as..." in MS Office 2007 ?
Sorry, but I did not found "save as..." menu in Office 2007. I only found in the upper left corner a flopy icon which represent a "save" but not a "save as...." So where is "save as..." (with files selction dialog) hidden in Office 2007? Camille Click the Office button (the round "pizza icon" in the upper left corner of the screen) and then click Save As. -- Stefan Blom Microsoft Word MVP "Camille Petersen" <cpet_magnus@hotmail.com> wrote in message news:4baf94cc$0$6768$9b4e6d93@newsspool3.arcor-onlin...

Macro
Can anybody tell me how to kick off a macro automatically as file is opened? Regards ...

Macro
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: intel Hi, I'm thinking of buying Mac: Office 2008, but before I do I want to check that I will be able to download Scritpsmart collection of templates without any glitches: <http://www.bbc.co.uk/writersroom/scriptsmart/faq.shtml> Does anyone know if I can do this? Regards, SP. In article <ee98ff5.-1@webcrossing.caR9absDaxw>, StregaItalia@officeformac.com wrote: > Version: 2008 > Operating System: Mac OS X 10.4 (Tiger) > Processor: intel > > Hi, > > I'm thinking of buying Mac: Of...

Help with macro/and or formula?
Perhaps this is a silly question, but i just can't figure out how t format this worksheet. The problem is that a lot of the cells hav numbers in them with negative signs in the back instead of in the fron (ie. 23-) and i was wondering if anyone knew of a macro/formula i coul use to quickly fix this problem for all the cells. I would b extremely grateful. Thanks -- brefed1 ----------------------------------------------------------------------- brefed15's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3557 View this thread: http://www.excelforum.com/showthre...

Attached Toolbars Macros
Excel 2003 I have a custom tool bar, this tool bar has several items, each item is pointing to a VBA code. This tool bar is attached to the worksheet. I've copied this spreadsheet to several computers. After I copied the spreadsheet I decided to rename the spreadsheet, after I renamed the spreadsheet the Toolbar Item's macros were still pointing to the old name, I reasigned each tool bar item to the current spreadsheet, saved the spreadsheet and everything was working on my computer, but when I re-copied the new spreadsheet to other computers and I clicked on the Toolbar Item...

Run macro automatically.
How do I make a macro run automatically when a worksheet it is attached to is loaded? right click on the sheet tab>view code>left window worksheet>right window activate -- Don Guillett SalesAid Software donaldb@281.com "Excel macro" <Excel macro@discussions.microsoft.com> wrote in message news:DD7AF1E3-9263-4523-AC49-A43ABA1AB9D0@microsoft.com... > How do I make a macro run automatically when a worksheet it is attached to is > loaded? I am unable to find "activate " when I right click on worksheet. ( i assume that you are referring to the windo...

save box greyed out
in ooutlook 2000 I can open office documents directly from outlook by just clicking on them no prompt it just opens (ie:word) also when opening non office attachments i get this box with save open grayed out example on webpage. http://www.planetarrakis.net/images/image1.jpg how can i fix it so i can either save from here or just open my paint program with out the prompt box? .. ...

Protected sheets and running macros
i have a sheet with a macro ran by a normal button at the top. Howeve when i protect the worksheet where ever i click on the sheet the macr executes. Can any one offer any advice on how to stop this? Thanks Robert -- Message posted from http://www.ExcelForum.com hi, i am not able to reproduce the problem, hence i may not be able t provide a panacea for that issue. here is what i suggest. i have a sheet that has a macro that is run when a control toolbo button (that is, not a form button) is clicked. this sheet is protected based on the user logged in. what i have don is to protect t...

Saving in 2003 Excel
I am currently taking Excel 2002 in college. The software I have loaded is 2003 but my Professor is running 2002. Can someone tell me how ot save in 2003 so the Professor can read in 2002? Hi Terry! Just save normally. You version challenged Professor will be able to open it. -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. Same file format, no problems.. -- Regards, Peo Sjoblom "Terry" <our.email@fuse.net> wrote in message news:384d...

Macro Freezes Reading Pane
I have a macro that Sends/Receives Tasks from Project Server into Outlook Tasks. Everything is working fine, except one weird thing that happens. I have the Timer set on the macro and it starts as soon as Outlook starts. The macro gets the tasks from ProjectServer every hour. As soon as the macro starts running the Reading pane freezes in the Inbox. If i stop the macro then Reading pane is back to normal. Can anyone please tell me if there is something I can do in VBA to fix this annoying issue. Thanks a lot ...

Macro to remove rows?
Hi, I receive thousands of rows of data from an extract that comes from a database. The data extract automatically generates page headers that need to be removed, and I would love to automate this process. The headers do have a pattern to them, but I'm not clever enough to figure out a good way to use that to write a macro. The first row of the header starts with hyphens ------------------------------- Then there's a variable number of rows of header data to delete followed by another row of hyphens ------------------------------- Then 2 additional rows that must be deleted. The nu...

Calling on a macro within a macro!
Hey All!! Quick Question - How do you call up a macro within a current macro? I have one big macro and I need it to jump to several other macros when it runs! Does it matter where the other macros are stored or is it better to have them all in one module? Help appreciated Thnx! Hi Mellowe, '=============>> Public Sub Main() 'Your code Call One 'your code End Sub '<<============= '=============>> Public Sub One() MsgBox "Hi from One" End Sub '<<============= > Does it matter where the other macros are stored or ...

shortcut keys to macros
Hi, Is it at all possible to assign shortcut keys to macros in Outlook? Thx, Hans ...

help Unable to record Macro !!!!!!!
I want to record a macro in excel.But as soon as I click record Macro it says "unable to record" macro. Got no help in excel help.I do this same thing in word and it's working. Please help It's urgent for me !!!1 Have a look here http://groups.google.com/groups?as_epq=unable%20to%20record&as_ugroup=microsoft.public.excel.* -- Don Guillett SalesAid Software donaldb@281.com "ash" <anonymous@discussions.microsoft.com> wrote in message news:3e0b01c42ae5$45333e00$a401280a@phx.gbl... > I want to record a macro in excel.But as soon as I click > record...

Macro that password protects a sheet
I am attempting to create a macro that can open a protected sheet, change something, and then protect it again. I continue to have an issue with the macro not entering the password. Is this possible to do/fix? Thanks, Ryan ..open password="mypassword" -- Don Guillett SalesAid Software donaldb@281.com "Ryan" <Ryan@discussions.microsoft.com> wrote in message news:D4780ED8-CA1D-4284-97BC-3576160D998E@microsoft.com... > I am attempting to create a macro that can open a protected sheet, change > something, and then protect it again. I continue to have an iss...

Footer Macro?
Hi Months ago I read a Public Sub Macro that read the selection of a drop down list in a combo box and placed it in the center Footer at the same time it also placed the date in the right Footer and tme in the left footer. I have searched most of the regular sites including this one and cannot find it anywhere --- Can anyone help with my search. Any help much appreciated Cheers ---- Mully ...

Keyboard Shortcut in Macro
Hi all i'v created macro with Keyboard Shortcut Ctrl+b . now i want to change it to Ctrl+z how can i do it . regards Tools-->Macro-->Macros. Select (don't open!) your macro, and hit the Options button. :) ************ Hope it helps! Anne Troy www.OfficeArticles.com "osaka78" <osaka78@discussions.microsoft.com> wrote in message news:1721A458-212D-4446-8209-494A459EE428@microsoft.com... > Hi all > i'v created macro with Keyboard Shortcut Ctrl+b . now i want to change it > to > Ctrl+z > how can i do it . > > regards THE MACRO IS NO...

Macros have been disabled but there is no macro
when I open a specific doc the info bar at the top says "Macros have been disabled", but when I hit Alt+F11 I can't find any VB or a module to remove. Why is it telling me about macros? Other docs don't give me this prompt. I thought I might have to enable macros to see the code. When I enabled macro, it said "do you want to save changes to this doc?" it flickered and came back as if immediately reopened. Any ideas? I could copy and paste the text into a new doc but I'd be interested to be able to strip off this problem. The doc is an internal IT ...

Email text disappears when click save
Text entered on an email disappears when we click save, even when using the Administrator account. ...

Run multiple Macros or macros from within other macros ?
I would like to run multiple macros at startup. What code should be used in the Private Sub Application_Startup command in the ThisOutlookSession area ? If the names of my macros were below what would the code to look like ? Macro1 Macro2 Macro3 I have looked at the samples from previous posts and cannot determine how to make them apply specifically to my needs. In Excel you can use the Run "Macro1" line and it would run that macro. Run does not work in Outlook I suppose because I kept getting an error. **** Also - What code is needed to execute a macro from w...

command button for save
ive created a form in microsoft access 2003. that is the blank form n will be use as a new data entry form. then, ive created a command button for the saving data purpose. but i dont know the coding for the saving purpose. i want to save it to my database. how can i do that? On Wed, 17 Feb 2010 18:09:57 -0800 (PST), ngeng ngok <ngeng4@gmail.com> wrote: >ive created a form in microsoft access 2003. that is the blank form n >will be use as a new data entry form. then, ive created a command >button for the saving data purpose. but i dont know the coding for the >savi...

Startup macro
Is it possible for automatic start of macro in moment when excel file is opening. I mean when I open excel file specific macro will be immediately automatic started. Zeno option explicit sub auto_Open() call yourspecificmacronamehere end sub Zeno wrote: > > Is it possible for automatic start of macro in moment when excel file is > opening. > I mean when I open excel file specific macro will be immediately automatic > started. > > Zeno -- Dave Peterson ...