Re: Finding file names
From: Dave Peterson (ec35720_at_netscapeXSPAM.com)
Date: 03/08/05
- Next message: Jim Rech: "Re: Microsoft Office Excel is waiting for another application to complete an OLE action"
- Previous message: ben: "RE: when condition is true, move row to end of different ***"
- In reply to: Andrew: "Re: Finding file names"
- Next in thread: Andrew: "Re: Finding file names"
- Reply: Andrew: "Re: Finding file names"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 08 Mar 2005 08:33:08 -0600
Did you include the folder and the extension in your filename?
You may want to post the real name that you're trying to find and the code
you've tried.
Andrew wrote:
>
> Patrick,
>
> Thanks for your reply. I'm sorry, but somtimes I get a little excited, & I
> forgot to mention that I only want to use the date to find the file. I've
> given your second suggestion a try, but I can't seem to get anywhere. Any
> further help would be greatly appreciated.
>
> Andrew
>
> From: Patrick Molloy
> Date Posted: 3/7/2005 2:49:00 AM
>
> yuo show an example file name with not just the date, but also the time. You
> code only adds the date.
>
> So EITHER add & Format$(mytime,"HHMMSS")
> OR use a loop to examine files in the target folder
> DIR() -- aged it may be, but it works well here...
>
> DIM sFileName as String
> sFileName = DIR(MyPath & "MyFileName20050325*.xlx")
> do while sFilename <>""
> If SFileName = MyFile then
> bFound = TRUE
> Exit Do
> end if
>
> sFileNAme = DIR()
>
> loop
>
> if not bFound then
> msgbox "Unable to find " & MyFile
> end if
>
> "Andrew" wrote:
>
> Andrew wrote in message ...
> To Whom it may concern,
>
> I need to make a macro which will open a flat file, format it, and count
> some cells in a column. I have the code necessary to complete all of the
> tasks, except that the file names have something that throws a "spanner" in
> the works. The file names follow the same format, which is
> "MyFileNameyyyymmddhhmmss", ie. the file name & date & time. I've tried a
> few methods I know of to open the file using "FileName:= "MyFileName" &
> Format(Date, "yyyymmdd"), but excel obviously can't find the file. What
> sort of code can I use to find a file name with the left most text similar
> to that above?
>
> TIA
> Andrew
-- Dave Peterson
- Next message: Jim Rech: "Re: Microsoft Office Excel is waiting for another application to complete an OLE action"
- Previous message: ben: "RE: when condition is true, move row to end of different ***"
- In reply to: Andrew: "Re: Finding file names"
- Next in thread: Andrew: "Re: Finding file names"
- Reply: Andrew: "Re: Finding file names"
- Messages sorted by: [ date ] [ thread ]