sueshe Posted January 30, 2008 Report Share Posted January 30, 2008 I have a macro that opens a file using variables T1 & T2, which give me the current year and current month, ex. filename: \MyDocs\%T1%\%T2%\%T2% MTD Stats.xls, which would be for this month, \MyDocs\2008\JANUARY\January MTD Stats.xls. This works fine for every day of the month except for the first day of the next month. I need it to pull the previous month if it is the first day of the next month. So, for instance on February 1st, will need it to pull \MyDocs\2008\January\January MTD Stats.xls. Is there a way to do this? Am new to Macro Express, so not certain how this would be achieved??? Any help would be appreciated! This is what I have so far: <MACRUN2:DATE - current year YYYY> <MACRUN2:DATE - current MONTH Mmmmm> <LAUNCHDEL2:0:01H:\MyDocs\%T1%\%T2%\%T2% MTD Stats.xls> Quote Link to comment Share on other sites More sharing options...
Cory Posted January 30, 2008 Report Share Posted January 30, 2008 I can't see what's behind your Macro Run command but I would use the Date/Time command with an offset. I owuld first set the day of the month to T1 <DT:dT:01:1:> and if T1=1 I would generate a previous month <DT:mmmmT:02:3:{P00000}{P00001}{P00000}{P00000}>. Works slick. The whole thing looks like: <DT:dT:01:1:><IFVAR2:1:01:1:1><DT:mmmmT:02:3:{P00000}{P00001}{P00000}{P00000}><ELSE><DT:mmmmT:02:1:><ENDIF> Quote Link to comment Share on other sites More sharing options...
sueshe Posted January 31, 2008 Author Report Share Posted January 31, 2008 I can't see what's behind your Macro Run command but I would use the Date/Time command with an offset. I owuld first set the day of the month to T1 <DT:dT:01:1:> and if T1=1 I would generate a previous month <DT:mmmmT:02:3:{P00000}{P00001}{P00000}{P00000}>. Works slick. The whole thing looks like:<DT:dT:01:1:><IFVAR2:1:01:1:1><DT:mmmmT:02:3:{P00000}{P00001}{P00000}{P00000}><ELSE><DT:mmmmT:02:1:><ENDIF> Thanks Cory! have put in place, so I'll see in the morning, since it's the first.... if it serves the purpose!!! Tasha Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.