Make (save) a file by using macro recorder.

Hi all,

I am new to macro and using macro recoder to create macro. On one file which 
I recieve every week from material department. I need to reformat and create 
pivot table. I use macro recorder and everything is working good. However I 
need that when my recorded macro end it create a file with the same name with 
the date and time it was create. I need every week a new file and I dont want 
to replace the one. Please let me know how I can create a new file with the 
date and time everyweek when I  run my macro. Thanks
-- 
Farhan
0
Utf
5/29/2010 2:41:01 AM
excel.programming 6508 articles. 2 followers. Follow

3 Replies
683 Views

Similar Articles

[PageSpeed] 50

Hi Farhan

This should do it, just insert your path in the MyPath variable:

Dim MyPath As String
Dim fName As String
MyPath = "C:\Temp\" 'Change to suit
fName = "MyFile_" & Format(Now, "mmddyy_hh:mm")
    ActiveWorkbook.SaveAs Filename:=MyPath & fName

Best regards,
Per

"Farhan" <hmfarhan@hotmail.com> skrev i meddelelsen 
news:5691DB10-33BF-40D2-B826-9D496A83EE9F@microsoft.com...
> Hi all,
>
> I am new to macro and using macro recoder to create macro. On one file 
> which
> I recieve every week from material department. I need to reformat and 
> create
> pivot table. I use macro recorder and everything is working good. However 
> I
> need that when my recorded macro end it create a file with the same name 
> with
> the date and time it was create. I need every week a new file and I dont 
> want
> to replace the one. Please let me know how I can create a new file with 
> the
> date and time everyweek when I  run my macro. Thanks
> -- 
> Farhan 

0
Per
5/29/2010 6:35:04 AM
But don't include the colon in the time portion of the format() argument.

"mmddyy_hh:mm"

I'd use:
"mmddyy_hhmmss"



Per Jessen wrote:
> 
> Hi Farhan
> 
> This should do it, just insert your path in the MyPath variable:
> 
> Dim MyPath As String
> Dim fName As String
> MyPath = "C:\Temp\" 'Change to suit
> fName = "MyFile_" & Format(Now, "mmddyy_hh:mm")
>     ActiveWorkbook.SaveAs Filename:=MyPath & fName
> 
> Best regards,
> Per
> 
> "Farhan" <hmfarhan@hotmail.com> skrev i meddelelsen
> news:5691DB10-33BF-40D2-B826-9D496A83EE9F@microsoft.com...
> > Hi all,
> >
> > I am new to macro and using macro recoder to create macro. On one file
> > which
> > I recieve every week from material department. I need to reformat and
> > create
> > pivot table. I use macro recorder and everything is working good. However
> > I
> > need that when my recorded macro end it create a file with the same name
> > with
> > the date and time it was create. I need every week a new file and I dont
> > want
> > to replace the one. Please let me know how I can create a new file with
> > the
> > date and time everyweek when I  run my macro. Thanks
> > --
> > Farhan

-- 

Dave Peterson
0
Dave
5/29/2010 11:32:22 AM
Thanks friends , I will try it on Monday and let you know. 
-- 
Farhan


"Dave Peterson" wrote:

> But don't include the colon in the time portion of the format() argument.
> 
> "mmddyy_hh:mm"
> 
> I'd use:
> "mmddyy_hhmmss"
> 
> 
> 
> Per Jessen wrote:
> > 
> > Hi Farhan
> > 
> > This should do it, just insert your path in the MyPath variable:
> > 
> > Dim MyPath As String
> > Dim fName As String
> > MyPath = "C:\Temp\" 'Change to suit
> > fName = "MyFile_" & Format(Now, "mmddyy_hh:mm")
> >     ActiveWorkbook.SaveAs Filename:=MyPath & fName
> > 
> > Best regards,
> > Per
> > 
> > "Farhan" <hmfarhan@hotmail.com> skrev i meddelelsen
> > news:5691DB10-33BF-40D2-B826-9D496A83EE9F@microsoft.com...
> > > Hi all,
> > >
> > > I am new to macro and using macro recoder to create macro. On one file
> > > which
> > > I recieve every week from material department. I need to reformat and
> > > create
> > > pivot table. I use macro recorder and everything is working good. However
> > > I
> > > need that when my recorded macro end it create a file with the same name
> > > with
> > > the date and time it was create. I need every week a new file and I dont
> > > want
> > > to replace the one. Please let me know how I can create a new file with
> > > the
> > > date and time everyweek when I  run my macro. Thanks
> > > --
> > > Farhan
> 
> -- 
> 
> Dave Peterson
> .
> 
0
Utf
5/29/2010 5:02:01 PM
Reply:

Similar Artilces:

Linking files 2 ways
I have a work book that is linked to another and vise versa. As thus: Workbook A is where the input of data is made; Workbook B has a link to the input from workbook A; Workbook A retrieves the altered data back as a link. Although this all works fine with both books open, I note that if I open workbook A by itself, that the data it retrieves from Workbook B is not updated . If However, both books are open, there's no problem. I thought linked books were updated automatically if the Update remote references has been selected?? But it appears that the second book is not updated until it ...

OL2007 not move big files from outbox to sent
Hi, We have 2 computers with separate email accounts on Roadrunner. One machine has XP with Outlook 2002-sp3 and works without any problems. The other has Outlook 2007 on Vista and has problems sending files over a meg or so in size. It seems to actually send the file but the file remains in the outbox folder and does not move it to the sent folder. I say it "seems" to send the file because some people complain of getting muliple copies and others don't seem to get them at all. If I hit send again (not set up for auto send) it seems to send the file again (why some ...

Formula without using numbers after decimal in the answer
I have a formula that derives the answer from a figure with a decimal. I don't want to use the figures after the decimal. Is there a way to just use the whole number and omit the numbers after the decimal without having to manually key in all these numbers manually? Thanks, Mustang You can use the INT function. This 'rounds down' any number to th nearest integer, e.g. if A1=2.567, a formula in B2 of =INT(A1) return 2 HTH Bruc -- swatsp0 ----------------------------------------------------------------------- swatsp0p's Profile: http://www.excelforum.com/member.php?...

Merging Two Office Data Files
This is a multi-part message in MIME format. ------=_NextPart_000_0038_01C3C6E7.505DB790 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Here is the situation: I've a desktop and a laptop. Before I bought the laptop I was using MS = Outlook on my desktop. Now that I'm using my laptop mostly, I would like = to have my old emails from my desktop Outlook merged with the laptop = Outlook emails. I don't want to replace the laptop outlook files with = the desktop outlook files is the folder - C:\Documents and = Settings\Laptop\Lo...

Unable to Save in Publisher 2000 to Flash Drive
I work in a school district and one of our teachers uses Flash Drives/Memory Keys (whatever you want to call them) for her students to save their projets on. She's starting a unit on Microsoft Publisher and had the students open a template off the flash drive and change it and resave in a folder on the flash drive but all the students are getting the following error: "There is no disk in the floppy drive or the drive door is not closed. Please make sure that the floppy drive is ready, then try again." -It is not a permissions issue - even the teacher is unable to save to...

Using Relative path for XML data file?
Is there a way to specify a relative path to an XML data file imported into Excel 2003? I am writing a web app that generates report data as XML for the user to download to their local machine. This data is to be consumed by an Excel reporting spreadsheet, which contains display-formatted tables and charts that are mapped to various data fields in an XML Map, which is in turn linked to the xml data file they will download. The idea is the user only needs to download the data for updates, not the whole spreadsheet. However, since I cannot predict the path where the user will store their...

How to repair a .dll file in IE8
Several days ago I noticed in my Dependency Walker that the IESHIMS.dll files has a yellow circle with a question mark on it. What does this mean and How do I repair it? OS: Windows Vista Home Premium Browser Internet Explorer 8 -- TW Hi, See the History tab on that dialog. A web search for ieshims.dll files will also help you find a solution for that file. Regards. "TW" <TW@discussions.microsoft.com> wrote in message news:63E61463-D766-4ABC-B081-BFA8C04FB159@microsoft.com... > Several days ago I noticed in my Dependency Walker that the IESHIMS....

unsolicited entry in the folder "Temporary Internet Files"
Hello, I am working on a programme which browses web sites and runs under XP. The http download is as follows: pServer = Isession -> GetHttpConnection(strServerName, nPort); pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET, strObject, NULL, 1, NULL, NULL, dwHttpRequestFlags); pFile->SendRequest(); pFile->QueryInfoStatusCode(dwStatusCode); if(dwStatusCode == 200) { pFile -> QueryInfo(HTTP_QUERY_LAST_MODIFIED, &sysT); status.lastMod = sysT; if(DBlastMod == status.lastMod) //URL content has not changed since the last visit ...

Maximum file sizes
Is there a recommended maximum file size for Excel 2000. PC spec 2Ghz P4 with 256 Mb Any advice appreciated Deus -------------- Does Not Exist Hi have a look at http://www.decisionmodels.com/memlimits.htm -- Regards Frank Kabel Frankfurt, Germany "Deus DNE" <deus.dne@ntlworld.com> schrieb im Newsbeitrag news:1561701c41d4f$358950f0$a001280a@phx.gbl... > Is there a recommended maximum file size for Excel 2000. > > PC spec 2Ghz P4 with 256 Mb > > Any advice appreciated > > Deus > -------------- > Does Not Exist ...

find action on log file
Hello there I want to use outside tool to find who made some update on table in my server I know that there are many tools for this. But can they do it on simple recovery model? Roy Goldhammer (royg@yahoo.com) writes: > I want to use outside tool to find who made some update on table in my > server > > I know that there are many tools for this. But can they do it on simple > recovery model? No. If you are using the simple recovery model, the contents of the log is wasted away everyonce in a while. Well, if the disk area has not been overwritten...

File size #11
I have read the other discussions on file sizes but they do not seem to address my problem. I have an Excel file that is 12mb large with low-res jpegs in it. This file also has merged cells to make it look pretty. Does Excel look at these merged cells as graphics? Is this why they are too big? I have run a macro to make sure that it goes to the last cell. How can I get the file smaller? How big are the graphics? If you remove them from the file, what is the size of the file and what is the size of the graphic files? To be sure you do not have extra formatting, if you open the file...

CSV Files and VLOOKUP error
Does anyone know why VLOOKUP and Compare formulas don't work o information originating from a CSV file? I've tried copying an pasting values only (to leave behind any formatting), but it doesn' help. Through countless tests, I've narrowed it down to the CSV file bein the only possible cause -- Message posted from http://www.ExcelForum.com Hi ajpowers, Just a guess but the imported data may have leading or trailing spaces or are numbers stored as text. You could use the formula =A1=D1 to see if you get a true or false, where A1 is the lookup value and D1 ia the CVS valu...

using the journal on outlook
Once I link an email to the journal, can I still find that email in my mail box? I seem to be able to get to it only via the journal. If this is the way it is supposed to be, how do I remove it from the journal and get it back into my mail box? Am I just missing something? -- thanks, Independent Are you linking to the item or putting a copy into the journal item? Also, has the item been archived or not? "Independent" <Independent@discussions.microsoft.com> wrote in message news:868279F2-53C8-403A-97F5-604CEECD873C@microsoft.com... > Once I link an email to the journ...

Savings a/c cashflow doesn't show withdrawals
Money 2003 When I do a cashflow forecast for my savings a/c it doesn't take into account transfers to my "cash" account - the one I use to keep track of what I spend my cash on. Consequently when I do the cashflow it gives an unreal projection of savings. I wish I could save $3000 in 2 months but it's not going to happen... ...

Save as .doc
In Outlook 2003 there is no option to save an eemail as .doc. is there setting that can be turned on to allow this? REBeyer wrote: > In Outlook 2003 there is no option to save an eemail as .doc. > is there setting that can be turned on to allow this? Not that I know of. You can save as .txt, open in Word, and save as a Word doc, though. "Lanwench [MVP - Exchange]" wrote: > REBeyer wrote: > > In Outlook 2003 there is no option to save an eemail as .doc. > > is there setting that can be turned on to allow this? > > Not that I know of. You can save as ...

Disable Secure Sockets Layer on exchange server when using RPC over HTTP
Hi im trying to enable RPC over HTTP to enable users to establish contact to my Excahger server 2003 over the internet. Now, I dont want to use SSL (security not that important) and i am told by this article that i can disable SSL in windows registry. Quote: Note While RPC over HTTP does not require Secure Sockets Layer, you must modify the registry to enable RPC over HTTP if you do not want to use Secure Sockets Layer. Microsoft recommends that you enable and require Secure Sockets Layer for your RPC over HTTP communications. At this address: http://support.microsoft.com/?id=833401 But i ...

How to automate increasing the form cache registry/file etc...
I want to roll out a batch file to make a number of tweaks to CRM The body of it would go REGEDIT /S Kerberosefix.reg REGEDIT /S ForceFormreload.reg REGEDIT /S OutlookFix.reg It would also rename OSA.exe to OSA.bad Remove OSA.exe From the startup menu I need help finding a way to use my batch file to increase the Outlook Form cache from the default 4MB to 50 MB.. This makes CRm more stable and faster for communications. I dont want to manually do this, as it time consuming, are my end users would not be reliable in doing it themselves. I also want to make another batch file or button that...

I need a macro
I would like a macro to do the following: I would place the the cursor in any cell and this macro would give me the average of all the entries to the left if the selected cell. EX: I place the cursor in cell M12. I want this macro on display in cell M12 the average of all the values from Col C12 to Col L12. Note that there may NOT be entries in all the cells in that range. Also the start point would always be col C .Thanks You can do this easily with a worksheet_selection event in the sheet module but you would probably want to restrict to a certain range or columns and rows or it woul...

New Record
I'm using the following in the On Click of a command button. DoCmd.GoToRecord acDataForm, "frmMyForm", acNewRec Anyway I can do this without referenceing the Object (Form) name?? James James, Yes... DoCmd.GoToRecord , , acNewRec God Bless, Mark A. Sam "JamesJ" <jjy@adelphia_darwin.net> wrote in message news:er2loxDPIHA.1208@TK2MSFTNGP03.phx.gbl... > I'm using the following in the On Click of a command button. > > DoCmd.GoToRecord acDataForm, "frmMyForm", acNewRec > > Anyway I can do this without referenceing the Object (Form)...

Does Outlook use the DAV protocol?
I'm an Outlook Express user who wants to switch to Outlook. I received a notice from Microsoft that includes the following: "... as of June 30, 2008, Microsoft is disabling the DAV protocol and you will no longer be able to access your Hotmail Inbox via Outlook Express." Please tell me if this action by Microsoft will affect Outlook in the same manner, or am I free to make the switch. "BudV" <BudVitoff@(NO)att.(SPAM)net> wrote in message news:%230XUDi%23zIHA.2384@TK2MSFTNGP02.phx.gbl... > I'm an Outlook Express user who wants to switch to Outlook...

After editing example1.xls and click SAVE, the filename changes to AABBEE.xls
After editing example1.xls and click SAVE, the filename changes to AABBEE.xls. The original file still exist and has been updated but the 'funny' filename also have the same content, and editable. The example1.xls is stored in a server and accessed by many people within the company. Everyone accessing to the file will change the filename unknowingly after saving it. ...

Let me use the Line Color icon on charts
It would speed up a lot of my work if I could use the Line Color icon on Excel charts, the same way I am able to use the Fill Color and Font Color icons. However, when I highlight any chart object, like the Plot Area, Chart Area, or a Series, the Line Color icon is disabled. -- Stuart Bratesman, Jr., MPP Muskie School of Public Service Univ. of Southern Maine Portland, Maine ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If ...

Cannot Delete Any Records
We're running CRM 3 Rollup v3 and we have recently found that we cannot delete any records in CRM. We recently migrated over to a Windows 2003 Enterprise install running SQL 2000 Enterprise. Everything else is working without issue for us. For example I am a Sys Admin, and I receive a generic SQL Server error when going to delete an activity? I know that in the past this was possible, any thoughts? Sean; sounds like something went wrong with your migration. you can run a CRM trace or a SQL Profiler trace while performing the deletion to see if you can pin-point the error. Dave Ire...

form fields not saving to table
I have created a database with a form and three of the fields are not saving the information to the table. I have checked the row and control sources and now at a loss and thoughts? As you scroll through existing records is the data of the table displayed? Post the SQL of the query or form source. -- Build a little, test a little. "Kim" wrote: > I have created a database with a form and three of the fields are not saving > the information to the table. I have checked the row and control sources and > now at a loss and thoughts? > > ...

Outlook 2000 calendar save as web page wrong dates.
Hi, When I save my calendar as a web page the dates are in error. This has just occurred in year 2005. Microsoft's site says it is a known issue but gives no details of how to resolve it. Anybody got any ideas? Regards Brian. Hi Brian, According to KB EN-US;891521 this issue is still under investigation. You can access this article by clicking on the link below. http://support.microsoft.com/default.aspx?scid=KB;EN-US;891521 Regards, Scott Atkins MCSE, MCSA Partner Technical Lead - Outlook Microsoft Technical Support for Platforms and Business Applications -------------------- ...