VBA to call file based on date

Hello,

I wonder if anyone can help me with a VBA routine to check for the presence
of a specific file.
The file is saved on a dialy basis in the format "userfile_run_YYYYMMDD.xls"

i am seeking help with a vb code that will check if  today or any specified
days report is generated. i guess excel can use the date format to read the
specified location for the file.

Thank you in advance for your help.


.....Coming from Where I'm from.


0
4/23/2005 3:27:18 PM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
744 Views

Similar Articles

[PageSpeed] 35

Dim sFile As String

    sFile = Dir("C:myPath\userfile_run_" & Format(Date,"yyyymmdd") & ".xls")
    If sFile <> "" Then
        Msgbx "File Exists
    End If

-- 

HTH

RP
(remove nothere from the email address if mailing direct)


"fLiPMoD�" <dr_hunter_uk@yahoo.co.uk> wrote in message
news:d4dpgi$nre$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
> Hello,
>
> I wonder if anyone can help me with a VBA routine to check for the
presence
> of a specific file.
> The file is saved on a dialy basis in the format
"userfile_run_YYYYMMDD.xls"
>
> i am seeking help with a vb code that will check if  today or any
specified
> days report is generated. i guess excel can use the date format to read
the
> specified location for the file.
>
> Thank you in advance for your help.
>
>
> ....Coming from Where I'm from.
>
>


0
bob.phillips1 (6510)
4/23/2005 4:29:15 PM
Perfect...you are a star.

Thanks.

"Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
news:efyoYGCSFHA.3704@TK2MSFTNGP12.phx.gbl...
> Dim sFile As String
>
>     sFile = Dir("C:myPath\userfile_run_" & Format(Date,"yyyymmdd") &
".xls")
>     If sFile <> "" Then
>         Msgbx "File Exists
>     End If
>
> --
>
> HTH
>
> RP
> (remove nothere from the email address if mailing direct)
>
>
> "fLiPMoD�" <dr_hunter_uk@yahoo.co.uk> wrote in message
> news:d4dpgi$nre$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
> > Hello,
> >
> > I wonder if anyone can help me with a VBA routine to check for the
> presence
> > of a specific file.
> > The file is saved on a dialy basis in the format
> "userfile_run_YYYYMMDD.xls"
> >
> > i am seeking help with a vb code that will check if  today or any
> specified
> > days report is generated. i guess excel can use the date format to read
> the
> > specified location for the file.
> >
> > Thank you in advance for your help.
> >
> >
> > ....Coming from Where I'm from.
> >
> >
>
>


0
4/23/2005 8:24:15 PM
Reply:

Similar Artilces:

Creating a new field based on conditions
I have a database that tracks insurance information for our various vendors. Each insurance type has 2 fields - a requirement field (yes/no), and an effective field (some show an expiration date, some are yes/no). I have created a query that will return only the records for which insurance is required but is expired/missing. My problem is that I want to create a new field that is calculated based on the values in the other two fields in order to make the resulting report more user-friendly. For example, if GLRequired is True and GLExpiration is <Now(), I want the new field to say...

parsing a date and time field #2
I am having trouble parsing the date and time in a field. I download data from a data base and the date and time come together in one field. I want to seperate the two. The date and time comes across as the following: "2/1/2009 14:37" in the cell. When I parse it, it seperates into three columns as follows: "2/1/2009", 2:37 AM", and "PM" I can see what is going on but I would like to get two columns with one as the date and the other as the correct time. are they any ideas on how to address this? Try using the TimeValue and DateValue functions. First format ...

Tracking Dates For Future Occurrences
Can this be done? I want to track a yearly review. I would like the date, once entered - say 6/1/2009, to conditionally format to change yellow 30 days before, then red 15 days before, and then to stay red until the date is updated again for say 6/1/2010. Can this be done? I am new to all this, thanks.. In 2007 Also.. "Knee2no" wrote: > Can this be done? I want to track a yearly review. I would like the date, > once entered - say 6/1/2009, to conditionally format to change yellow 30 days > before, then red 15 days before, and then to stay red until the date is...

Help with PST file
Every now and then for whatever reason I get the message that my pst file can't be accessed (Outlook 2000 SR1). So I try to create a new one because I don't know how to fix the problem. After hours of trying, searching for help, etc I get a new pst file. However now in my folders list I have several other personal folders. Also I can never figure out how to get my email addresses from the old personal folder (contact folder) to the newly created one. Can someone help me? I've got to say that much of this goes over my head. For instance I keep reading where I'm supposed to ...

file cloning
I was wondering. How come it is possible to clone a file (using right click copy/paste file), but not possible to do this for other documents (apps and clip-art etc)?. Could it be possible to have an add-in in excel to prevent people from copying documents on their desktop?? -- shnim1 You can copy files that way (rightclick|copy, rightclick|paste). But most windows applications are no longer just simple .exe files (like back in the old DOS days). They usually have tons of other stuff that gets installed with them--and that stuff gets scattered all over your harddrive (windows folder, wi...

Distribution Files for MFC in VS .net 2003
I have an app that was developed under Visual Studio VC++ 6.0 & MFC and deployed at our customer site. I have since installed Visual Studio .NET 2003 and rebuilt the application under the new development environment. I wanted to do a quick test of the executable and copied it up to a test machine and tried to run it. I got a series of "unable to find xxx.dll" errors. I realized that none of the new DLLs were installed on the test machine. Does anyone have a pointer to a good document on what distribution files are required? I know about the obvious ones like MFC71.DLL...

Save formatted text from RichEdit control to rtf-file
Hi , How can I save the text from Rich edit control (2.0) to *.rtf , *.txt , *.doc I tried to get the buffer and putting the buffer to file, then saving the file but the text in the file is something different. Please let me know what to do? Here is the Code I ma using: mFile.Seek( 0, CFile::begin ); CString cBuffer2; int iTotalTextLength = m_oChatMessageControl.GetWindowTextLength(); HWND focusWnd = ::GetFocus(); m_oChatMessageControl.HideSelection(TRUE, TRUE); m_oChatMessageControl.SetSel(iTotalTextLength, iTotalTextLength); cBuffer2 = m_oChatMessageControl.GetSelText(); LPTSTR...

VLookup in VBA giving error message
Hi, I'm having trouble making the vlookup function work in VBA. the values that are used are all dates, I don't know if that makes a difference. Worksheets("sheet1").range("a1").value = application.WorksheetFunction. _ Vlookup(Range("c1"), range("a:a"), 2) this gives me a run-time error '1004' Unable to get the vlookup property of the Worksheet function class so i tried this: Worksheets("sheet1").range("a1").value = application.Vlookup(Range("c1"), _ range("a:a"), 2) but this gives me a #REF ...

converting tabular structures in a Word document into an actual table or reading data from the tabular structures using VBA code
I have a macro which can read the last cell/column of all tables in a Word 2003/2007 document and store the data in an MS-Access table. But, some Word documents have the data in structures like a table format but are not actually tables. The structure looks like a table, but the table borders are actually line connectors. These documents were created by a software(VeryPDF PDF to Word converter) which converted the PDF documents(the original format these documents were) into Word documents. 1. Is there a way I can convert/replace the tabular structures with actual tables in Word so t...

Trying to create an Update query based on HR data to find upline V
Hi All, looking for some advice. I have an HR table that contains employee information but does not contain management chain info. Basically i am trying to determine who the employees upline VP is. The fields i have to work with are [Employee Name], [Manager Name] and [Job Title]. I figure the logic would be to check the employees' manager and if the manager is a VP (based on job title), return the manager's name to a field called [VP]. If the manager is not a VP then check that manager's manager, so on and so forth until a VP is found. Any ideas would be much appr...

how to build the netsample ipconfig to the exe file?
C:\WINCE500\public\common\oak\drivers\netsamp\ipconfig\ipconfig.cpp i want to make ipconfig.exe. and i could found the sample code. but it source code builded to the lib file. in ipconfig sources files, TARGETNAME=ipconfig TARGETTYPE=LIBRARY SOURCES= \ $(TARGETNAME).cpp the project is .lib file. but the source code has a _tmain() funciton in the source. it's looks possible to compile to the exe file. how can it compile to the exe file? You can add the SYSGEN_NETUTILS and you will have the ipconfig.exe integrated to your OS. Search ipconfig in the cat...

How do I export Lotus Approach files into an Excel spreadsheet?
I need to export data from Lotus Approach to Excel; please help. I am using an old version of Lotus SmartSuite 9.5 and I have Microsoft Office 2003 Basic. Well, I don't know Approach at all but is there a common file format that both use e.g. comma delimited. If so , save in that format from Approach and import into Excel. "LEWOLF" wrote: > I need to export data from Lotus Approach to Excel; please help. I am using > an old version of Lotus SmartSuite 9.5 and I have Microsoft Office 2003 Basic. ...

Sumproduct with multiple date criteria
Having a tough time with this one. Sheet 1 Column A = Start Date, Column B = End Date, Column C = Quantity. Sheet 2 Row A = Start Date, Row B = End Date. I would like Row C to sum quantity from sheet 1 where ever the two date ranges intersect. The date ranges on sheet 2 represent the beginning and ending of a week (Mon-Sun). Sheet 1 Column A Column B Column C 01JAN2010 24JAN2010 1,000 Sheet 2 Row A 04JAN2010 11JAN2010 18JAN2010 25JAN2010 Row B 10JAN2010 17JAN2010 24JAN2010 31JAN2010 Row c 1,000 1,000 1,000 0 Do the Sheet 2 Star...

outlook can't receive exe files
A guy here at work can't get exe files through his outlook. Is there a check to uncheck somewhere to allow it to do this? He can receive normal attachments. ...

retrieving folders.old file
probably been posted before, but need some help. i was getting the "MSIMN has caused an error in directdb.dll" i found the solution by renaming the folders.dbx file to folders.old. here's the problem, i opened express back up and my sent folder was empty. my question is, how or can i retrieve that old sent message list?? ...

Need code snippet to read offline PST file
Hi friends, I have a PST file in my local hard disk and have requirement to read PST file and parse through all folders and then each message item in all folders and then segregate them to different folders based on subject line. Please kindly send the code for the above requirement. Thanks & Regards Ramesh -- ramserp You're going to have to write your own code. Do you know anything about Outlook programming at all? You can start out by looking at information and code samples at www.outlookcode.com. -- Ken Slovak [MVP - Outlook] http://www.slo...

Using atl based win dll with CString functions from the mfc projec #3
I have atl based general windows dll with class which contains functions which uses CString as parameters or return values. This dll might be used from the atl or mfc project. Dll can be used from ATL project without problems but whenever I try to use this class from the MFC project I get the following linker errors: error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall MyClass::AddMenu(long,class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &,long)" ... If I replace CStri...

Excel 2000 vs. Excel 2002
I am having troubles with a workbook that I created that is havin problems opening. I created it in 2002, and it opens fine in Excel 2002 for other people However, when I send it to someone who has Excel 2000, it takes over a hour to open. Now I also made a very similar report that works just fine whe trasferred to excel 2000. Here are a couple of stats on the workbook that is having problems: 1.5mb 500+ externel links 500+ subtotals 200+ simple calculations (a1+b1; a1/b1;etc..) 1 Worksheet in the book. 2 columns with conditional formatting Thanks, Joh -- Message posted from http://ww...

Any FREAKIN' way to import DBX files into Outlook 2003
I've tried: Importing via Outlook | Import from another Program or File Importing via Outlook | Import Internet Mail and Addresses Exporting from Outlook Express Tried Many, many times... Can Microsucks make this any more complicated... It's a FREAKIN' DBX file collection NO - No other Application has it Open. YES - The Files ARE there YES - the Internet Account IS there Yes - I've wasted more of my time IMPORTING into Outlook Express in VISTA just to RE-EXPORT back to Outlook. What a bunch of freakin' idiots... Another 2 hours wasted - because one Microsoft applica...

copying formulas in vba
Hey guys. I was wondering if someone could help me. I am writing a vba script that takes in data, analyzes it, and then copies the results to a new file. I am having a problem with two things. 1) I am using a template for the new file so there are a lot of formulas (sums and std) already defined and ready to use. However, there are some instances where there is a random amount of additional data I have to put in. So, I have to apply the same formulas to this new data. How do I copy formulas from one cell to another (allowing for a change in row) in vba? Lets say cell(1,4) has the form...

Opening .prn files in XL2000
I am using a software that does not save data/reports in .csv or .xls formats; only in printed versions. Is there a way to save the printed report in a file and open the file in XL2000? If there is, how is the print file produced, where is it saved, etc? A friend suggested setting up a generic printer but didn't know how to go about it. You may want to give that other software just one more chance--look under File and see if there is a SaveAs option. You may find something upon further review. But if you want to add a generic printer, I think it'll depend on your version of win...

Converting date from an external source
I am having an issued with converting a date from external data source. the data has the timestamp in the general date form mm/dd/yyyy 00:00:00. I want to convert the date to mm/dd/yyyy format so when i run a query for a single day it will return the data for that date, I can currently return the data but i have to set the parameter in the mm/dd/yyyy 00:00:00 format, i want to simply return the data by setting the parameter in the mm/dd/yyyy format Don't confuse how data is stored with how it is presented. As long as you import the date into a field defined as a Date data type, you...

Import reg files into Registry, without UAC
Hi, I've got a .reg file to be imported silently in a batch. The file contains only entries in HKEY_CURRENT_USER, therefore can be imported without elevation. This works well with the regedit /s switch on limited accounts, however on admin accounts, elevation UAC prompt is still shown, even though it's not needed. How can I prevent this? Thanks, Jens Jens M�ller wrote: >Hi, > >I've got a .reg file to be imported silently in a batch. The file contains >only entries in HKEY_CURRENT_USER, therefore can be imported without >elevation. >...

using vba so search multiple Sheets
i'm trying to search across multiple sheets based on data submitted via an input box. So essentially, you click the button, a box appears, you type what your looking for and if it finds it, it'll select it otherwise a error message appeats. i found the below code, but it only works if the cell with the value in it is active (i.e. i've clicked on it). Code: Dim datatoFind Dim sheetCount As Integer Dim counter As Integer Dim currentSheet As Integer On Error Resume Next currentSheet = ActiveSheet.Index datatoFind = InputBox("Please enter the value to search...

Retreive a deleted file
How can I retreive a delted file Hi Janet If you have setup Excel to automatically create backup copies; then check that folder for the last backed-up version....If it is from your PC, check out the Recylcle Bin (on your desktop) and restore the file. If the file was on a network drive you may need to contact your network administrator and check whether they can recover. -- Jacob (MVP - Excel) "Janet" wrote: > How can I retreive a delted file Go into your Recycle Bin. If deleted from there; http://www.ozgrid.com/Services/recover-deleted-files.htm ...