Calculating week numbers in VbScript should be easy, just use the 'Datepart' function. Unfornately Datepart can't handle the last week in a year.
For US week numbers jan 1. is always in week one and the first day of the week is Sunday, so this Datepart call should return the week number:
week = DatePart("ww", date, vbSunday, vbFirstJan1)
That week number will be correct for most of the year except the last week of December. That week will only be correct if it is a full seven day week (ie. dec. 31 is a Saturday). The 'WeekNumberUS' function corrects that error by finding the weekday of jan 1. in the following year and counting backways to the start of that week in december. If the value of 'd' is in that range the week number is 1, in all other cases Datepart is used.
For the ISO-8601 week numbers used in Europe, week one is the first week with at least 4 days in the new year and the first day of the week is Monday so this Datepart call should return the week number:
week = DatePart("ww", date, vbMonday, vbFirstFourDays)
The first version of WeekNumberEU was just that and it seemed to work fine, but before publishing the script to the Script Center I made an extensive error check with US and danish calendars from http://www.timeanddate.com/ and found that the function fails in the year 1907. So
the same method is used as for US week numbers, but the function makes a recursive call to itself to find the week number of jan 1. in the following year and use that instead of week one.

Picture shows the error in dec. 30, 1907. Datepart return week 53, it should be week 1.

VB Script
Edit|Remove
```' Calculate weeknumber for a date
' EU/ISO-8601 and US
' By Jørgen Bigom

' Return weeknumber for EU/ISO-8601
Function WeekNumberEU (y, m, d)
Dim tempweek
If m = 12 And d > 24 Then
tempweek = WeekNumberEU (y+1, 1, 1)
If d > (32-Weekday(Dateserial(y+1,1,1),vbMonday)) Then WeekNumberEU = tempweek:Exit Function
End If
WeekNumberEU = DatePart("ww", Dateserial(y,m,d), vbMonday, vbFirstFourDays)
End Function

' Return weeknumber for US
Function WeekNumberUS (y, m, d)
If m = 12 And d > 24 Then
If d > (32-Weekday(Dateserial(y+1,1,1),vbSunday)) Then WeekNumberUS = 1:Exit Function
End If
WeekNumberUS = DatePart("ww", Dateserial(y,m,d), vbSunday, vbFirstJan1)
End Function```