Opening Workbooks Based On Date In The File's Name

May 30, 2009

I'm trying to develop a macro to amalgamate some data on currency exchange rates that are stored in different files with the dates saved in the file's name. The code of the macro I recorded when opening an example of such a workbook is:

View 5 Replies


ADVERTISEMENT

Personal.xls File Not Opening With Other Workbooks

Aug 25, 2008

I have a problem when opening Excel work books, The Personal file will not open automaticly. The file is in the XLStart folder. The link is "C:Documents and SettingsUSERApplication DataMicrosoftExcelXLSTARTPERSONAL.XLS. I have a desk top short cut I need to open first manually. Also the menu bar short cuts I had to my VB code and Macros will not work. Any body have any ideas what the problem may be? Im sure its a simple link problem but I don't know where to look.

View 2 Replies View Related

Workbooks.Open Not Opening File Or Workbook

Oct 27, 2006

I was wondering if anybody could catch an error in the following code. I have a file, let's call it a "Guide" which is opened by user and at this time this file has only one purpose - to help user choose the program. After clicking on the "Choose Program" command button, an Inputbox appears where the user types in a program. Then the code should open the file with this program and this is pretty much it. But something is not working with the code below, and I do not see anything wrong with it after looking at it for so long. It just does not do antthing. how to handle the "Choosing" option

Private Sub CmdBttn_ChooseProgram_Click()
Dim sFilename As String
On Error Goto ErrorHandler
sFilename = "Approval_" & Application.InputBox("Input Program")
Workbooks.Open Filename:="C:Documents and SettingsjsmithDesktop" & sFilename & ".xls"
ErrorHandler:
'if file name does not exist error message should display. Not defined yet
End Sub

View 3 Replies View Related

Date Being Updated On Consequent Opening Of File

Nov 20, 2006

I have created a spreadsheet and saved it as a template. when the staff open it to enter information they use save as and give it a name. They only need open and enter information once. I have put into this spreadsheet in cell A1 a formula to enter the days date. This all works fine. A few days later I need to access the spreadsheet to check the figures entered and obviously the date changes to the date when I open it up. Is there any way of stopping this happening without using macros. i.e. keep the date as the day they entered the information.

View 9 Replies View Related

Opening A Text File With Todays Date

Jun 7, 2007

I know that the below code goes some way to opening a text file that I'm importing. The thing is, I want it to do this every day and work out the filename itself.

This should be simple as the filename is based on the date.

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;c:docs oday_06062007.txt", Destination:=Range("A1"))

All I want to do is have the start of the filename: 'C:docs oday_' and add the date in the same format automatically...

View 9 Replies View Related

Showing Column With Today´s Date When Opening File

Feb 16, 2010

I have an infinite list of consecutives dates on a row like the one below. I want that everytime I open my file, the first column shown is the one containing today´s date. If today´s date is 16.Feb, then the first column must be the one containing 16.Feb and so on.

15. Aug.16. Aug.17. Aug.18. Aug.19. Aug.6060606060

View 10 Replies View Related

Opening Worksheet Based On Specific Date

Jan 25, 2007

I have a workbook that contains worksheets whose sheetnames are specific to each day of the month ie: 1st 2nd 3rd 4th 5th, and so on up to 31st. I am trying to write an workbook open procedure to check the day of the month and match it to the relevant worksheet so it will open to that day. for example if opened today being the 25th, i want the code to unhide sheet named 25th and select it, whilst all other sheets bar one is hidden.

View 5 Replies View Related

Opening A File Without Opening A Workbook

Apr 17, 2007

I have a need to open a file from my companies intranet. My current method was to open said file via the method that the recorder gave me. However, I would like ot be able to open a said file without having to start open another workbook.

This is the path:
[url]

So the command is this:
Workbooks.Open [url]

Links are not actual links

So what I need to know. Is how can I open this file without opening a workbook. I haven't been able to use the VB "Open Statement" to open a file and I don't believe that I've been successfull using the Filesystem object either.

View 9 Replies View Related

Macro To Download Csv File From A Dynamic Date Based Url To A File Location

Feb 23, 2014

I have a requirement to download a lot of historical data files from the archieve of an website. The url goes something like this: [URL]....

This downloads file for 21022014 ie. 21-Feb-2014. I need to be able to have a facility to have a selection criteria on my user form (in excel) where I specify a date range and the macro automatically downloads all the valid excel files available within that date range (files for Saturday, Sunday and some holiday dates will not be available in the website archive database) one after the other (like at single clcik of button) into a specific location (predefined viz.. c:/Users/EOD files/) on my laptop. Best would be if I am able to select the save location run time by using a 'Browse' like feature where I go and choose my local laptop folder...same type when we try uploading a file from our laptop to the web..

View 1 Replies View Related

Opening Two Workbooks Using VBA?

Feb 6, 2014

I have a spreadsheet that I need to open two other workbooks to copy and paste data from.

The name of the two workbooks changes each day, and the location because they are filed in subfolders.

I have the following code, which works to open the first sheet but then comes up with the following error when trying to open the second sheet. "Run-time error '1004: Excel cannot access 'Hub PVA'. The document may be read only or encrypted".

The folder is not encrypted because when I was only opening the second document with the same code, it worked.

The code I am using is:
'DECLARATION
On Error GoTo ERR1:
ChDir "G:GENERALTRANSPORTDAILYPLANS"
Workbooks.Open Filename:="G:GENERALTRANSPORTDAILYPLANS"

[Code]....

View 3 Replies View Related

Opening Workbooks In A Folder

Dec 1, 2008

Is there a way to use a for next loop to open a workbook that is in a folder, then save and close the workbook then open the next workbook in the folder and do the same routine till all the workbooks have been updated?

View 12 Replies View Related

How To Work With Workbooks Without Opening Them

Apr 26, 2012

I am making a macro and I need to extract some data from workbooks. However, I have many workbooks and it would take time to the macro to open and analyze each of them.... is it possible to work with workbooks without opening them?????

For instance, I need to open a workbook and get all rows that contain the word HEXXX..... However, I have about 30 workbooks and it would take forever...

View 2 Replies View Related

Opening Workbooks Via Hyperlink?

Sep 3, 2012

I have a Sharepoint site which seems to be set up incorrectly as I cant even do a webquery with it, or sync Excel with it.

I want to be able to open up the Excel workbooks held in this one dir within Sharepoint take some data out of it pop it into another Excel workbook and move on down to the next one!.

So far all the code I have managed to locate causes errors, so I have managed to get a feed from the Sharepoint site which gives me a hyperlink to all the docs (as these can change). What I now need is some code to run through all the hyperlinks open the doc (if it ends in xls or xlsx as some are PDF's!) take the info copy it out and move on to the next one.

View 1 Replies View Related

Open Excel File Based On Date In File Name That Is From One Day Before

Apr 24, 2014

I need to open an excel file based on a date mentioned in the file name, but minus 1 day. The file name is composed with Statistics_date_time.xls

Example: statistics_20140423_142754.xls

Once I need to open the file (only in the mornings), it has to be the one from the previous day to see the yesterdays performance. How can I create a macro that will look at the date in the file and take the one from yesterday?

This will be a part of a macro I'm making. The rest of the macro will just format the file and combine a few ones from different departments.

View 4 Replies View Related

Opening Workbooks From Macro In Toolbar?

Mar 13, 2013

What I'm trying to achieve.I'm trying to create a toolbar to have visible in excel which provides me with shortcuts to a selection of functions and some other useful documents.

I've created a document "Toobar 1.xls" in column B of which I have the file locations of the documents I want to open, the documents are moved from time to time and it is easier for other users to update the spreadsheet than vb.As you can see below I've written a piece of code to open up a document, I've created a function because there are a few documents I want to create links to and thought it would be cleaner to do it like this. This code is stored in "Module1" of "Toolbar 1.xls".

I've then created a new toolbar in excel and added a custom menu item and allocated it the macro "Pension_Credit_Calc".

When I run the code from within "Toolbar1.xls" it works fine, however if I try to run it from another workbook I get "run time error 1004". I suspect it's probably something to do with where I've stored my code,

PS. The reason I have not simply created a shortcut in the quicklaunch bar is that I will also be altering the workbooks once opened.

Code.

VB:
Function OpenUp(FileLocation) As String
Workbooks.Open (FileLocation)
End Function [code]....

View 2 Replies View Related

Opening The Workbooks In A Folder, One By One, To Make Changes

May 11, 2007

I'd like to create a macro which will

-go to a given folder

-open each of the workbooks in the folder, one at a time

-after opening the first wkbk, go to a specific cell address on the first tab of the wkbk

-paste in some values and formulas

-save the workbook

-open the next workbook, and repeat as above, for all workbooks in the folder

View 9 Replies View Related

Reading Data From Workbooks Without Opening Them

Nov 21, 2007

I would like to read data from Worbooks through VBA code and UserForm without opening them. Is it possibe?

I know I can read data from Workbooks without opening them if I write this formula directly into a Worksheet cell:

='C:Documents and SettingsUserNameDocuments[FILE_NAME.xls]Sheet1'!$A$1

The problem is it won't work for my task. I just need to analyze with UserForm Controls and For Each loops through many cells and many big Workbooks.

If I try:

Private Sub UserForm_Initialize()
Dim aaa as String
aaa = 'C:Documents and SettingsUserNameDocuments[FILE_NAME.xls]Sheet1'!$A$1
End Sub

OR

Without opening the file if I try:

With Workbooks("C:Documents and SettingsjohnMy DocumentsmProjectfilename.xls").Worksheets("sheet1")
For Each thing ...
....
Next
End With

In both cases it gives me - Compile error: Syntax error, Expected expression.

I can also say that I definately don't mistake path, workbook's or worksheet's name
------------------------

If you're not quite sure that my explanations are clear I wrote some more below:

Reasons i want this:
It's just a lot of traffic/memory to Open/Activate/Close many Workbooks/Worksheets from 10MB files for just taking one or a few values to an UserForm :->

What I do:
I'm using several Workbooks to manage data. One of them consists of the Macro code (ThisWorkbook.) and the rest of the Workbooks are just tables with data I use. On UserForm with controls such as (ComboBoxes, CommandButtons, ListBoxes, Labels etc.) I find, visualize, compare and copy just the data I need from other Workbooks to ThisWorkbook(on a new worksheet) :->

The idea of my task is:
1. I have 10 files, each of them 10-20MB with data.
2. Now, I'm making 1 file with VBA code which analyse these 10 files and displays the information in it.

The general idea is that these 10 files are well structured but have many columns and rows and it's not convinient each time I need to find 3 numbers I need to open 10MB file, scroll 5 minutes, copy/paste the numbers, close the file...i just want an UserForm with several controls to do this job

Each of these 10MB files consist of let's say about 10000 rows and 100 columns. Between these rowns and columns there's data (or empty cell). Everytime I use one of these files I need different information. So, if I use the formula you gave me, I should copy exactly the same Workbooks in one file but with formulas.

With the macro code I just go through these rows and columns and find the specific data I need with For Each loops. Everytime I need different data. With 4 ComboBoxes I just select an year, a name, a code (by rows) and another code (by columns) and I get the needful info.

This info could be in one file, could be in many files, it could be in HZ45 cell (file 1), it could be in C5 cell (file 2), the next time I would need file1,2,3,4,5 with cells GF45, J7, KK88, DR8, Y90 etc. etc. etc. So, the problem is that every time I need different information from these 10MB files, each of them consist of 10000*100 cells*10 files = 10 0000 000 cells which I have to write the formula you gave me and it will become one 100mb excel file, which is no good.

View 9 Replies View Related

Opening 2 Workbooks In Separate Windows

Dec 1, 2009

I have 2 workbooks open and I want to set up formulas from one linking to the other. When I toggle on the task bar between the 2 workbooks they replace each other within the same window so I can only see one workbook at a time. How do I set it up so I can have 2 separate windows open at the same time, one with each workbook in it? I tried 'side by side' in one window but the viewing area is too small.

View 9 Replies View Related

Opening Excel File From List Of File Names Located In Single Sheet?

May 31, 2013

loop and range function to apply in the below code through which I can avoid writing code for all the rows.

I am trying to open excel files located in single folder from files name (along with the path) in single worksheet (Column B and Row 1 to 500).

I have created follwing code which opens the file and then runs a macro in it.

a Sub Test()
Dim strFName As String
strFName = Sheet1.Range("B2").Value

[Code].....

View 4 Replies View Related

Opening Multiple Workbooks In Alphabetical Order?

Dec 3, 2012

Work have just upgraded from 97 to 03 (very with the times ) and when opening multiple workbooks, 03 behaves differently.

With 97 I could select many sheets from the open window and excel would open them in alphabetical order. Now we've moved to 03, the order seems to be completely at random. It's a real pain, as the set up of the workbooks we use has everything linked together. In order to keep everything working sweet, various groups of workbooks need to be open at once. Previously it was easy to find a workbook in the task bar, but now they're scattered everywhere. We don't use a set list of workbooks - the selection we need to open varies quite a bit, but there's usually at least 20 or so.

View 5 Replies View Related

Opening Workbooks And Running A Unique Macro From Them

Jan 22, 2008

I have a macro that at the moment just opens a workbook SpreadsheetA.xls,

Sub OpenA

Workbooks.Open Filename:=C:DocumentsSpreadsheetA.xls, UpdateLinks:=0

End Sub
SpreadsheetA.xls has a macro called "ExpectedRun" which is currently operated by clicking a commandbutton.

What is the code to run the "ExpectedRun" Macro in Sub OpenA?

Eventually I'll be opening a bunch of these workbooks, each with its own unique "ExpectedRun" macro, so is there any special command to call on the "ExpectedRun" macro for specifically the opened workbook?

View 9 Replies View Related

VBA Code For Opening File With Variable Version Number In File Name?

Jan 29, 2014

I have a file that I save with a new version number each time I make major changes. The file name currently is: "Telephony Equipment Inventory v26 (Summary).xlsm". The "26" is the variable number. give me the vba code to ensure I open the file with the highest version number?

View 6 Replies View Related

Excel Opens Multiple Workbooks When Opening Any Workbook?

Jan 27, 2005

The same two workbooks open when I open any other workbook. They also open up when I open Excel by itself.

View 9 Replies View Related

Open File That Changes Name Every Day Based On Today Date

Apr 16, 2014

I have the current code that opens our raw data file and copys it into my workbook. However it now turns out the file is saved everyday as a new file with todays date on the end. Here is my current code:

Sub CopyRaw()
Application.DisplayAlerts = False
Sheets("PROD_SELECTION").Visible = True
Sheets("PROD_SELECTION").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True

[Code] .....

Todays file is now in the name "I:SalesSales and MarketingMarketing List Product Selection Details (20140416)"

I know i can do this somehow using the Date function but the closest I have got is using

"YEAR(NOW())&RIGHT(MONTH(NOW())+100,2)&DAY(NOW())"

To generate todays date like so: "20140416" but I dont know how to get that into my code correctly so i open the file with that on the end.

View 1 Replies View Related

Name File Based On Date & Week Number

Aug 25, 2007

on a macro i use to open, update a file and then save it in an archive.

Opening and updating the file is no problem, but i want to save under a dynamic name in a folder structure. This is a reoccurring task, and this way I update the same file each period but save a copy with the current data in an archive under a different name in the right place of a directory (archive).

My idea is to have a hidden cell in this workbook, where I can have the name calculated by simpe excel-formula, i.e. ="Filename_"&WEEK(TODAY())&"_"&YEAR(TODAY())&".xls".

The file should go automatically into an archive-directory, lets say C:data....archive2007 (2008, 2009, etc)
I want to add the last folder to my filename, so my macro knows the first part of the path and has to go look up the actual name it gets in order to be saved.

So I end up with a cell containting the filename: 2007Filename_35_2007.xls

Now I only need the macro which looks up this name, adds it to the hard programmed path:
C:data...archive
so that the file gets saved under as: C:data....archive2007Filename_35_2007.xls

this is how i start:

Workbooks.Open Filename:= _
"C:data....Filename.xls"
' here the file is updated...
Windows("Filename.xls").Activate
ActiveWorkbook.SaveAs Filename:= _
"C:data....archive'(how do i do this?)'", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close

View 3 Replies View Related

Saving Multiple Workbooks At One Time/file As A Text File

Mar 16, 2007

found the following code which works for 1 workbook at a time. I am trying to save 7 workbooks at 1 time. Is it possible?

Sub SaveAsCell()
Dim strName As String

On Error Goto InvalidName
strName = Sheet1. Range("V77")
ActiveWorkbook.SaveAs strName

It will work on the first sheet but none after that. I need to have each workbook saved with the value in cell V77. Also if that is possible, is it possible to change where the file is saved as well?

Right now I have a master workbook that will open the 7 other workbooks, paste data onto several pages in each workbook. I would like the macro to save the workbooks. The workbooks are named: 02 Tuesday, 03 Wednesday, 04 Thursday, 05 Friday, 06 Saturday, 07 Sunday, 08 Monday.

View 9 Replies View Related

Opening A File ...

Sep 18, 2008

I am trying to do something simple but not quite sure how to do it. I am using the GetImportFileName and then selecting information of one sheet from that file and copying to another workbook. I need to know how to then get back to the file I have opened to search the next sheet and so on. The problem I have is with this line.

Workbooks(FileName).Activate

Sub GetImportFileName()
Dim Finfo As String
Dim FilterIndex As Integer
Dim Title As String
Dim FileName As Variant

' Set up list of file filters
Finfo = "All Files (*.*),*.*"

' Display *.* by default
FilterIndex = 5

' Set the dialog box caption
Title = "Select a file to Import"

' Get the Filename
FileName = Application.GetOpenFilename(Finfo, FilterIndex, Title)

' Open the Filename
Workbooks.Open FileName

WPD
End Sub

View 9 Replies View Related

Opening PDF File

Mar 12, 2006

When I press the button , i would like to open PDF file. The path is "\ engineeringABC.pdf"

View 2 Replies View Related

File Copy And Create Folder Based On Date

Nov 22, 2011

I want this filecopy to:
1. create a new folder in a subfolder called "/certificates".
2. name that folder the current date. ie. "/certificates/23.11.11".
3. copy the file into that folder.
4. If it's a duplicate then rename the file " - 2" or what ever the next number is.

Code:
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False

[Code].....

View 3 Replies View Related

Import Sheets Where File Path Is Date Based

Jan 8, 2008

I have a script that generates various worksheets based on the day and puts these in folders based on the year/month/day. So a report run today would be in the F:200817 folder.

At the end of each month and then again at the end of the year I need to pull all the reports into a single workbook. The macro I have now allows you to select the folder you want to import the sheets from, but it doesn't recurse subdirectories, so I can only import sheets from a specific day into a workbook, but not from a month/year.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved