Save Macro with date in name

Hi,

I have a macro that I want to complete by saveing the file with the current 
date ate the end of the file name. 

I have this code but I get an error with the "DateAdd". 

ActiveWorkbook.SaveAs Filename:="Monthly Accrual Upload" & DateAdd ("MMMM") 
& " - " & DateAdd ("yyyymmdd") & ".xls", _
        FileFormat:=xlText, CreateBackup:=False

How can I get the file name for April to be;

Monthly Accrual Upload - APRIL - 20101604

Thanks
Rick

0
Utf
4/16/2010 4:49:01 AM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
1192 Views

Similar Articles

[PageSpeed] 51

Use Format() as below

Msgbox "Monthly Accrual Upload - " & Format(Date, "MMMM - YYYYDDMM")

-- 
Jacob (MVP - Excel)


"RD" wrote:

> Hi,
> 
> I have a macro that I want to complete by saveing the file with the current 
> date ate the end of the file name. 
> 
> I have this code but I get an error with the "DateAdd". 
> 
> ActiveWorkbook.SaveAs Filename:="Monthly Accrual Upload" & DateAdd ("MMMM") 
> & " - " & DateAdd ("yyyymmdd") & ".xls", _
>         FileFormat:=xlText, CreateBackup:=False
> 
> How can I get the file name for April to be;
> 
> Monthly Accrual Upload - APRIL - 20101604
> 
> Thanks
> Rick
> 
0
Utf
4/16/2010 5:10:01 AM
Reply:

Similar Artilces:

Check Names
Using Outlook 2000 under Windows 2000 Server. When I type a partial name in the To: field on a new email, I get the red squiggly line indicating there are multiple names matching that pattern. When I hit Send, I get the Check Names window showing a list of matching names. However the only names that show up in the list are from the Global Address List, and none from my Contacts. Under Tools, Services, Addressing tab, I have two entries in the "When sending mail, check names using these address lists in the following order". First is the Global Address List, and second is Contacts,...

Field names?
Can anyone tell me what type field and the field names are for the Vote Tracking Recipient and Response? I do see one called "Voting Response" under "All Mail Fields", however that is only showing me my vote responses to someone else, i.e. not thost that I've sent out for a vote myself. Please help, Steve The Voting Response field works for me in my Inbox when I recieve votes in response to an email I send out with Voting Buttons on it. Judy Gleeson MVP Outlook Trainer and Consultant read my articles here: www.judygleeson.com Canberra, Australia how to post qu...

SumProduct with date and time
I have finally found that with my formulas the calulations are based on the time. Can someone help me find the best way to correct this without using macros to strip the time out of the data. Bob 09/08/2007 01:05 13/08/2007 00:00 Bob Bill 10/08/2007 23:39 Bill Kyle 11/08/2007 07:36 Kyle Bob 16/07/2007 20:39 Bill 27/07/2007 19:59 Kyle 18/07/2007 16:51 Bob 14/07/2007 16:31 Bill 21/06/2007 16:46 Kyle 30/06/2007 16:55 Bob 12/06/2007 01:05 Bill 13/06/2007 23:39 1 2 0 1 1 Kyle 14/06/2007 07:36 1 1 1 1 1 Bob 12/01/2007 20:39 1 1 2 0 1 Bill 13/08/2006 19:59 Kyle 14/05/1999 16:51 These are t...

Find function in a macro
I want to set up a macro that searches a column for a value 'X' and then selects the cell right under the cell that contains 'X'. I have been stumped on this for a few days now and would really really appreciate any sort of help or guidance. Thanks a lot! SK --- Message posted from http://www.ExcelForum.com/ Sub Findit() Dim r as Range For Each r in Range("A1:A1000") 'Or whatever yours is If r.Value = "X" Then Range("A" & r.Row+1).Select 'Change A to your column Exit For End If Next End Sub K P.S. You could probably use an...

dynamic charts using named formulas
I have dates in the first row I have values in the second row I use tecnique of named formuls of offset function (tushar Methta) so that the chart is updated when data for new dates are added. now after some time I want to delete the older data If I delete the columns of older dates the named formula get messed up and I get error message that three is some wrong reference. actulally in the offset formula the starting cell is relaced by "REF" Then I have to redo the whole exercise any solutions. If the first row is some sort of header that doesn't get deleted, use it as the ba...

Rename name so formulas show name change
Excel 2003 Cell A1 is named MyCell. Cell A2 has formula "=MyCell". I rename cell A1 in the toolbar to NewCell. Cell A2 still has the formula "=MyCell". How do I rename cell A1 to NewCell and have it automatically change cell A2 to the formula "=NewCell"? Thank you for your help. Download Jan Karel Pieterse'e Name Manager here: http://www.jkp-ads.com/OfficeMarketPlaceNM-EN.asp -- Kind regards, Niek Otten Microsoft MVP - Excel "John" <no.email@no.email.com> wrote in message news:ORne6k3$GHA.4592@TK2MSFTNGP03.phx.gbl... | Excel 2003 |...

'Turning on' automatic name checking and completion??
Does anyone know how to get this function to work. I see alot of info on how to disable it, but nothing on how to get it to work. In the Advanced Email options I have these to items checked: 1) Automatic Name Checking 2) Suggest names while completing To, CC, and BCC F fields. But when I start typing a name or email address it does not search. I have used the 'detect & repair' option on outlook and tried it on a clean outlook install and still nothing. Any Suggestions? Sounds like normal behavior to me. "Suggest Names" works while you type, but only uses data ...

Java vs. C++ (Date class)
I'm porting some Java code into C++. Which class I should use instead Date class? Note that Date support miliseconds. Also, which class I should use instead of Vector class? std::vector? "Petar Popara" <my.fake@mail.net> wrote in message news:uG6VGpUfFHA.2424@TK2MSFTNGP09.phx.gbl... > > I'm porting some Java code into C++. Which class I should use instead Date > class? Note that Date support miliseconds. Oh dear. Both the Java and the C++ date classes do assorted odd things with time zones and "daylight saving"; neither is documented fully or ...

Validation code for macro to run
Hi...the code below works fine, but how do I change it so that it doesn't look for a blank cell (""), but looks for specific text in a cell? There is an If formula in cell C269 so that if 2 figures balance then this cell displays "TRUE", otherwise it displays "FALSE". The code mustn't run if Cell C269 displays "FALSE". If [C269] = "" Then MsgBox "The figures don't balance!!" Exit Sub End If Range("E1:E48").Select Selection.Copy End Sub Thanks. Rob Rob, try this, If [C269] =...

running macro when workbook is openned
I have the following macro it should run when the workbook is opened. I keep getting an error message. Any ideas. Isthere something that is missing Option Explicit Sub Update() With Sheet5 ActiveSheet.Unprotect Application.EnableEvents = False If UserForm4.CheckBox60.Value = True Then Sheet5.ComboBox3.Visible = True Sheet5.Label5.Visible = True Sheet5.TextBox29.Visible = True Sheet6.ComboBox3.Visible = True Else UserForm4.CheckBox60.Value = False Sheet5.ComboBox3.Visible = False Sheet5.Label5.Visible = False Sheet5.TextBox29.Visible = False Sheet6.ComboBox3.Visible = F...

Excel to XML: Need some help fine tuning a macro
Hey all, I've downloaded a Macro http://meadinkent.co.uk/ and have been editing it get the exported XML to appear as required, however I can't seem to get the 2 of my fields to display correctly. There are two fields which have numbers in but are formatted as text because I do not want them rounded up. One cell has -0.08162498 in it and in the exported XML doesn't even appear. Another cell has 51.51891794 in it and in the exported XML appears as 52. My question is how can I get the information to appear as I've typed it in rather then rounding it? I have cha...

Want to find max in a range then return a name from a cell
The spreadsheet has 5 people each person has a list describing thei sales performance. Each has their highest sale, highest over cost sale etc. I have a table with a describtion highest sale, highest over cost sal etc. I want the cell beside each title to calcute who has the highest figur and place their name in this cell. :confused: I have a spreadsheet with lists containing highest sale highest average sale etc. What I want to do is create a formula tha will find the max value within a list please note these values ar spread out and do not run on the spreadsheet side by side or one aft...

Name Tags in Publisher
I need to make name tags for an upcoming conference for our group. I'd like to do them in Publisher since I find it easier to working in graphics and words and still maintain logical formatting then if I use Word. However, I'm not finding any templates for doing name tags in P2002. How can I set up for doing Avery 2 1/4" x 3 1/2" name tags (CC10-OC)? Thanks Chet -- Chet Swanson mailto:cswanson@kendra.com Copyright 2003, Chester Swanson, all rights reserved ...

how to create a calendar to select a date in access 2007
I want to select a date from a pop up calendar on the form. Access 2007 automatically adds a date picker to a Date/Time field. -- Lynn Trapp MCP, MOS, MCAS "keithteri" wrote: > I want to select a date from a pop up calendar on the form. ...

Can I Save My Relationship
What if you could recapture your ex lovers mind, heart and soul?...Wipe the slate clean? Turn back time? Even if you feel right now that your situation is too far gone=85too screwed up =85or just plain too darn complicated? You already know how hard it is to just even wake up and roll out of bed in the morning. You leave your radio off on your way to work because every song is a painful reminder of him. You can't even bear to eat at the same restaurants you took her to. And if that isn't bad enough, you have to cope with the loss of friends and family that are on their side. Did you...

Creation date
Hi, I would like a way to insert the creation date of worksheet, not the creation date of the template. -- Thank you in Advance Merci a l'Avance Martin Hi you'll need VBA for this. Find below a UDF for this task: Public Function Get_Creation_date() As Date Get_Creation_date = ActiveWorkbook.BuiltinDocumentProperties("Creation Date") End Function Enter the following in your target cell: =Get_Creation_date() and format the result as date -- Regards Frank Kabel Frankfurt, Germany Martin Racette wrote: > Hi, > > I would like a way to insert the creation d...

Help: Can I change the date formula from mm/dd/yyyy to "mmm-yy" et
Hi, If the date was input as mm/dd/yyyy (12/31/2004), can I convert the format to "yyyy-mm-dd"(2004-12-31) or "mmm-yy"(Dec-2004)? i tried to change date format from "Format Cells-- Number tab--Category--choose "date" or "custom" but just failed. While Strangely, If i imput the data as "2004-12-31", i can change it to whatever date format i like. Appreicate your advice at earliest convenience. Thanks -- wintersunshine Hi sounds like your imported dates are not recognised as 'date' values but are stored as 'Text&...

Convert text to date 12-21-07
Hello, I am trying to link to a text file. I was having trouble converting 20011975 into a date/time format but it wasn't working. So I formatted the field as a text file. I have tried converting this to 20/01/1975 in a query but it comes out with errors and wierd dates. I've had a look at the other messages and had a go but no go. thanks Regardless of how your dates are displayed either by formatting or based on regional settings, all date functions exppect a month day year format. To convert your string to a date field: strTextDate = "20011975" SomeDate = DateSer...

Excel 2003 crashing on saving
One of the PCs in the office has a problem where it excel crashes upon saving large spreadsheets (anything above about 50mb) , however size shouldn't be an issue as that PC has 1gb of RAM. The same spreadsheet works fine on other PCs , and it happens on the problem machine no matter who's using it. Re-installing office makes no difference and smaller spreadsheets work fine. It puts an error in the event log , (ID 1000) Faulting application excel.exe, version 11.0.5612.0, stamp 3f39ff9d, faulting module excel.exe, version 11.0.5612.0, stamp 3f39ff9d, debug? 0, fault address 0x0007e7ae....

Retore original screen when macro ends
After running a macro, I would like to try and restore the screen to the exact view that the user had before running the macro - i.e. on the correct page and at the correct line, with the cursor in its original position and the screen scrolled to its original point (i.e. not necessarily at the top of the page if that was not the exact screen position). That is, so that the user sees no change to his/her view after the macro has ended. I presume that somehow I have to save all the parameters that define such things as page number, cursor position, zoom ratio, scroll position, et...

Follow Up Macro Question
Earlier, I asked about writing a macro to clear the contents of cells whose value was an alpha dash (-) without changing values or formats of the other cells. Based on expert feedback, I came up with the following solution. Highlight the desired range and run the following macro. Sub ClearDash() Dim s As String s = "-" For Each r in ActiveSheet.UsedRange If r.Value = s Then r.ClearContents End If Next End Sub This works just fine unless a cell in the range contains an error value such as #N/A in which case the macro aborts a...

Keep a date from updating
Hi there. When I run my macro it populates cell A1 with todays date, the problem is the next day the date changes to the current day. I would like the date to stay at the date the macro is run then the next day it keeps the date etc. so I can look back in the month and see the correct date. Please help , am I missing soemthing simple here? Convert the formula [I expect it is =TODAY() ] to a value within the macro with these three lines of code Range("A1").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=...

Date shows as 01/01/00
We have a spreadsheet that we want to enter a date in a cell. I have changed the format to Date 03/01/01 format but no matter what I do, any date is converted to 01/01/00. I have tried inserting a column, copying to another spreadsheet, etc. I know this is probably simple, but it's driving me crazy. Help please. In an un-used cell enter: =TODAY() if this is not the correct date, then touch CNTRL-ALT-F9 on the keyboard post what happens. -- Gary''s Student "Kmagg" wrote: > We have a spreadsheet that we want to enter a date in a cell. I have changed > the...

only save record when command button clicked
I have a form with numerous data entry fields on it. I only want the record to be saved when the saved command button is clicked to prevent partial record data from being saved. I can't use required entry because some fields need to stay empty. How would I do this? It must be easy but I just can't find how to do this. Thanks so much You don't really need a commaqnd button. Instead use the BeforeUpdate event of your form to cancel the save if the fields you want to save aren't filled. If you do want to save on a command button, you will need to unbind your form fro...

conditional printing? macro?
here's my situation, i have a workbook with many sheets in it, each sheet if the default print shortcut button was used would print to 4 pages of A4 paper. the data on these sheets varies everyday, someday's only 1 page per sheet would be full of data others 2, 3, or 4 etc. how could i write a macro that would be able to print only the needed pages?, each page, if it contains any data would have a value in a totals cell. so i would need code along these lines Sheets("sheet1").Select IF(OR(total1="",total1=0),"don't print","don't print"...