2 macros needed

MrLebowski

New Member
Joined
Apr 18, 2010
Messages
10
Hi,

I need a macro that search for last created/modified *.txt file in the given directory and opens it.

I'm using MS Excel 2007 that doesn't support Application.Filesearch :-(

Anybody can help?

Thanks,
Bart
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Upvote 0
Here's some code to help you get the right file

Code:
Sub getLatest()
    Dim fs, fldr, f, d, c
    Set fs = CreateObject("Scripting.FileSystemObject")
    fldr = "C:\Program Files\PKR\handhistory\VoodooRoller\20080720"
    For Each f In fs.getfolder(fldr).Files
        If Right(f.Name, 4) = ".txt" And f.datecreated > d Then
        d = f.datecreated
        c = f.Name
        End If
    Next
    MsgBox fldr & "\" & c
End Sub
 
Upvote 0
Here's some code to help you get the right file

Code:
Sub getLatest()
    Dim fs, fldr, f, d, c
    Set fs = CreateObject("Scripting.FileSystemObject")
    fldr = "[B]C:\Program Files\PKR\handhistory\VoodooRoller\20080720[/B]"
    For Each f In fs.getfolder(fldr).Files
        If Right(f.Name, 4) = ".txt" And f.datecreated > d Then
        d = f.datecreated
        c = f.Name
        End If
    Next
    MsgBox fldr & "\" & c
End Sub

Off-topic question:

Do you play Poker??? :-)

The code works perfectly. I needn't have made any corrections.

Thank you very much
 
Last edited:
Upvote 0
Yes I do - meant to take that bit of code before I posted it tho! My avatar on this site is taken from my pkr avatar

Are you a player of the great (and very frustrating) game?

I think face to face is way more fun than online.
 
Upvote 0
Yes I do - meant to take that bit of code before I posted it tho! My avatar on this site is taken from my pkr avatar

Are you a player of the great (and very frustrating) game?

I think face to face is way more fun than online.

Yes, I play a lot HU on FTP. And I am thinking about writing a some kind of HUD in excel. Not sure it will be useful, but want to try.

:)
 
Upvote 0
I was mulling the idea of creating some sort of replay module to decode hand history files ... along with about 2 dozen other projects!
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top