Open file with variable date name based on current date

Hello,

I have a folder containing different .xls report files with the name format 
"YYYY MM text.xls", where YYYY stands for year, MM for month.

I need a macro which, when run from an excel file saved in a different 
loacation, based on the current date, e.g. January 7, 2009, will open the 
file "2009 01 text.xls".

Thanks for your help,
Ciperian
0
Utf
1/7/2010 2:21:02 PM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
1177 Views

Similar Articles

[PageSpeed] 20

Workbooks.Open "C:\Foldername\" & Format(Now(),"yyyy mm") & " text.xls"

Except it will open 2010 01 text.xls   ;-)

HTH,
Bernie
MS Excel MVP


"Ciprian" <Ciprian@discussions.microsoft.com> wrote in message 
news:A83C96F3-C804-43BA-8FA7-2DBB4FB9A85D@microsoft.com...
> Hello,
>
> I have a folder containing different .xls report files with the name format
> "YYYY MM text.xls", where YYYY stands for year, MM for month.
>
> I need a macro which, when run from an excel file saved in a different
> loacation, based on the current date, e.g. January 7, 2009, will open the
> file "2009 01 text.xls".
>
> Thanks for your help,
> Ciperian 


0
Bernie
1/7/2010 2:31:59 PM
Reply:

Similar Artilces:

FRx 6.7: Accounts Not Displaying In Row File
I have successfully created Financial Statements for two of our three companies. However, I’m having a problem with the third one. In creating the row file, I specify a range from account 30000 through 99999. Most accounts show up in the list. Some don’t. The following account string will be my example of an existing account, with a balance, that does not show up in the row file: 00000-30035-00000 (30035 is the main account) If I manually insert a row into the row file, type in the description, and click the down arrow for the GL Link, the account does not display in the drop down. Ho...

How do I name categories of a pie chart
I am creating a pie chart of numeric values. I would like to add the names of each category. I don't seem to be able to find out exactly how to do it. HELP!! Right click within the chart, select "Format Data Series..." Go to "Data Labels" tab. Select "Series Name" or "Category Name" "RGC" wrote: > I am creating a pie chart of numeric values. I would like to add the names > of each category. I don't seem to be able to find out exactly how to do it. > HELP!! ...

Can not open folders containing emails. Says server not availble
I cannot open my folder for email files in Outlook. Get error message saying "set of folders could not be opened. Server is not available. Contact your administrator." What version of Outlook? What type of email acount/profile was created for Outlook to use? Did this work before? "Gil Moorman" <Gil Moorman@discussions.microsoft.com> wrote in message news:821C5535-AAD2-4C13-9BD4-C9EE4BB2798A@microsoft.com... > I cannot open my folder for email files in Outlook. Get error message saying > "set of folders could not be opened. Server is not a...

How to open workbook from workbook template without hardcoding
Hi Thanks for the answer to my previous question but I left out a vital point sorry. Could anyone tell me how to open a workbook from a workbook template, where both files are in the same folder, without hardcoding the path. I have tried code like this without success. Workbooks.open (Thisworkbook.path & "\somefile.xls") This code works fine when opening a workbook from another workbook, but not from a template. Thanks in advance Mick If the file that contains the code was based on a template, then you're going to have to save it before it has a .path property. (If y...

How do I make certain fields come up based on criteria?
Ok, please keep in mind that I am a beginner...so please make any responses very elementary in nature...THANKS! I have a table that is relaing information about why a child couldn't be placed (Foster Care). I have a Field as a Text Box with Certain prescribed reasons that are a drop down box. Here is my question. How can I have another table OR field appear on the form (that I want to create for inputting data) once they select a certain Reason (there are sub-reasons that go under each reason). Ex: Reason1 has a sub list of reasons (A, B, C) that should appear BUT if Reason2 is s...

Private EDB file
Hi, I am working with a client that has SBS2003 and is using Exchange 2003. There are 14 mailboxes with a total size of 4.5GB. When I look at the file size of the private edb, it is at 17GB. Why is there such a discrepancy and what can I do to shrink the size of the edb, so that I don't run into size limit problems. Thanks, Tom you need to perform offline defragmentation on the databases to also take a look at this site for updates SBS http://www.microsoft.com/WindowsServer2003/sbs/downloads/presp1.mspx http://consultusa.us/index.php?itemid=19 http://support.microsoft.com/kb/192...

Can't Open Calendar
Hello, User can not view her own calendar. The right pane says folder can not be displayed. Also, there is no checkbox next to her "My Calendar" only a small calendar icon. In addition, if she opens a shared calendar (also just has calendar icon, no checkbox), she can then go back to her calendar that now has a checkbox and open it. I don't understand why she has to go through all of these extras steps just to open her calendar. When she closes Outlook or goes back to her mail view, her calendar goes back to having the calendar icon and no checkbox and she can not op...

Transferring files #4
I have re-installed all my software on a new hard disk. (The old hard disk still installed and working). How do I transfer my diary from my old disk to my new disk please? Thanks. Bill Ridgeway Hi Bill, maybe this sites could help: http://www.slipstick.com/config/backup.htm http://www.slipstick.com/config/movepst.htm -- Oliver Vukovics Share Outlook without Exchange: Public ShareFolder Share your contacts, calendars or e-mails http://www.publicshareware.com "Bill Ridgeway" <info@1001solutions.co.uk> schrieb im Newsbeitrag news:edlvnj$9gr$1@news8.svr.pol.co.uk... &g...

How do you point to a named range in linked workbooks?
Workbook #1 has a range named "Gross Sales" in Sheet1 Cells A2:K2. How can I point to this range so that I can link it to Sheet1 Cells2:K2 in Workbook #2? Is this what you're looking for...? In workbook 2 enter "=[Book1]Sheet1!$A$2" in cell A2. Do the same for cells B2 through K2 with the correct respective links. Hope this helps. -Chad "KG" wrote: > Workbook #1 has a range named "Gross Sales" in Sheet1 Cells A2:K2. How can I > point to this range so that I can link it to Sheet1 Cells2:K2 in Workbook #2? Or, if you don't like to ...

API TO get User Name
What is an Win32 call to get the user name in the form of COMPUTER\\User ? >What is an Win32 call to get the user name in the form of COMPUTER\\User ? Have a look at GetUserNameEx NameSamCompatible Dave Hi Michael, Yes, just as David provided, GetUserNameEx will help you to retrieve the user or other security principal associated with the calling thread. If you got a different token other than the current calling thread, you may first call ImpersonateLoggedOnUser by passing the token to impersonate the token in the current thread and then use GetUserNameEx to obtain the user ...

Importing .VCS file
When I attempt to import a .VCS file created by Lotus Organizer 6.0 Outlook gives me an error message stating that I do not have the rights to import such a file. I was able to import one calendar event that was saved as a .VCS file. Any help would be appreciated. Thanks. ...

trouble sending large files
I am having trouble in outlook express 6 sending large files. When I say large I mean a half meg or larger. The send bar will go to about 99% and then just stay idle at that point. Eventually I get an error message that says it has stopped responding and asks what I would like to do. Continue trying or stop. No matter which I pick it stays the same. Then I find out it sends multiple copies for each time I try to stop it. This can be very annoying to my friends who have a dial-up. Any suggestions? Are your using a dialup or broadband (cable/dsl) account? If broadband, are you behind a...

Merging text files with excel
Hello All. How can I merge several text files with the same format into one Excel sheet in one go ? I am importing them singly but it would be much better to merge them together before opening. Many thanks for any help ! Maybe you can use some old DOS commands. Shell to a command prompt and issue an old DOS command to concatenate the Text files. Windows start button|Run (or flying windows r as a shortcut!) win98: Command WinXP/NT: CMD Go to that folder: C: (to change to that drive) cd\myfolder1\myfolder2\myfolder3 to change to that folder copy *.txt All.Files Ren All.Files All....

Bulk Extract Embedded Files
Word 2003 on XP Is there a way to extract embedded files all in one go? Like the image file extraction process described in http://www.gmayor.com/extract_images_from_word.htm but for embedded files? Many thanks DeanH Found the following for extracting embedded word files. Haven't tried it though. Sub ExtractFiles() ' ' ExtractFiles Macro ' ' Dim shape As InlineShape Dim folderName As String Dim a As Document folderName = Replace(ThisDocument.Name, ".", "_") MkDir folderName For Each shape In ThisDocument.InlineShapes ...

Problem importing data from text file
Hi, I have a comma delimited file that has twenty column names followed by six rows of data. I am trying to import this into Excel. When I do this, the data imports entirely into row one. It does import into difference cells but there is one row with 120 cells of data. I was expecting it two "Wrap" and start importing the data into cell A2. Can anyone help with this? How do I show the break between column headers and data? Thanks, Chuck ...

convert money plus files into money 2007
I downloaded the new trailversion of money Plus. Now I do not like the new version of money Plus . I had money 2007, but now I cannot convert my money files from the Money plus version into the Money 2007 version. What can I do? When you converted your M2007 file to M+ there was a screen message telling you that it had made a backup. You *of course* made a note of this!?!? If you didn't go and look for a file *.m16. Rename this as *.mny and reinstall M2007. Of course you will have to reinput all transactions since the conversion. -- Regards Bob Peel, Microsoft MVP - Money F...

Shared file doesn't share
We have a shared file that now gives us a message that someone else is in the file and do we want to open as read only. Anybody know what might cause this? Well... YOu can set the file to read-only by right clicking on the file and choose the properties dialog box to avoi getting this error message. THis will prevent you from modifying the file kanan ...

Change Name of Command Button
How can I change the name of a command button to text entered in cell a1? -- comotoman ------------------------------------------------------------------------ comotoman's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=27292 View this thread: http://www.excelforum.com/showthread.php?threadid=477556 try this highlight the cell edit-copy right click commandbutton while in design mode click <properties> highlight name now edit -pastespecial hit enter toggle design mode "comotoman" <comotoman.1x5sih_1129741514.3488@excelforum-nospam.com&g...

Script for changing users date format
Hi, Is there an easy way to change a bunch of users date format in one go? Thanks, Sophie Hi Sophie, Have you look into using workflow to update the data format field fo the users? Darren Liu, Microsoft CRM MVP Crowe Horwath http://www.crowecrm.com On Dec 16, 6:27=A0pm, Sophie <Sop...@discussions.microsoft.com> wrote: > Hi, > > Is there an easy way to change a bunch of users date format in one go? > > Thanks, > Sophie Hi Darren, Thanks for getting back to me. I can't find anywhere in the workflow an option to change the date format? Thanks, Sophie &qu...

create new mail item from current item
Greetings, How can I create a new mail item from the active inspector current item? Thank you, Please provide more details on what you want to do. In other words, what does the current item have to do with the new item you want to create? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "lindstrom" wrote: > Greetings, > How can I create a new mail item from the active inspector current item? > Thank you, > > --- > fr...

How do I create a pdf or txt file?
I need to get my word files that save as (.doc) to a (.txt or .pdf) file. Is there anyway to do that without the software? This is a multi-part message in MIME format. ------=_NextPart_000_0012_01CA7C42.604BDA30 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Deana, This newsgroup is specifically for matters dealing with Microsoft = Project. I suggest you try to find a more appropriate newsgroup that = deals with Word problems. However, from the Save As... dialog, at the bottom is Type selection = which should ha...

Intermitent file problem?
Running Outlook 2003 and from time to time the frame with the Inbox list of emails and viewing pane will be blank with an error message stating the system is busy and that perhaps something else has it tied up. How can I debug and fix? ...

How do I delete excess pages from a file?
I'm sending a file that I only need one page in, but the recipient has told me that it has 1700 pages. I'm using Excel and sending with outlook. What does the file look like from your end? Has it got 1,700 pages or just one? "deejai03" wrote: > I'm sending a file that I only need one page in, but the recipient has told > me that it has 1700 pages. I'm using Excel and sending with outlook. In Excel jargon a File is a workbook. A workbook can have multiple worksheets. A worksheet can have multiple pages when printed. What exactly is the...

can only see one page of a multiple page publisher file
today can only see the first page of a file in publisher....checked the attributes removed the read only....could not remove from overall i.e. my documents...can pull up on another computer via network and see all....so file appears to be okay...can also print all pages, but can only see and work with page one...HELP.....AND A BIG THANKS TO WHOMEVER!!!! What happens when you try to click on the other pages? Do you have the status bar turned on? (View - Status bar) -- JoAnn Paules MVP Microsoft [Publisher] "CON" <CON@discussions.microsoft.com> wrote in message news:...

view: group by sent date (or any other date)
Hallo, I want to group my sent mail by day (and not by day, hour and minute). So if I have sent 200 e-mails in the previous 14 days I want to see 14 groups instead of nearly 190 because they are not clusterd by day. I have tried to create a new field (formula,= integer(sentdate)), this field works fine in a normal view but if I want to group with it, then outlook does not allow it (I think no new, selfmade field allows grouping). Who can help? Thank you very much in advance! Sabine I thought I had the answer - but it didn't work. Still, if I tell you what I did, it might spark some ...