Question : Saving a filename with the week number of the last sunday

I'm using this snippet to determine the last sundays date, based on today but I need to save the week as part of filename i.e.  that Sunday (22/06/08) lies in the 4th week. so saving it as Junewk4.xls
Code Snippet:
1:
2:
P = Weekday(Now(), vbMonday)
P = Int(Now()) - P

Answer : Saving a filename with the week number of the last sunday

try something like this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Dim MonthValue As Integer
Dim MonthDays As Integer
 
MonthValue = DatePart("m", p, vbMonday)
MonthDays = DatePart("d", DateAdd("d", -1, CDate("1/" & MonthValue + 1 & "/2008")))
 
Dim fileName As String
fileName = MonthName(DatePart("m", p, vbMonday), False) & "wk" & CInt(MonthDays / 7) & ".xls"
 
Debug.Print fileName
Random Solutions  
 
programming4us programming4us