UDF week date Calculation using a VB Script

SUGGESTED

Hi, 

I've been working on a VB Script that allows the Date field to auto populate based on a customers lead time and return a valid weekday date. The lead time is established in a separate UDF field were the days are selected from a list-box (field is numeric). i.e Todays Date + 10 day Lead time= valid weekday date.

When validating the script, the system says "Syntax Check Passed" but when i add the field to our SO_Entry Header. It freezes the screen and i receive error 88.

Error 88_Invalid/unknown property name

O/S Error_Illegal assignment: 'Date' (err/ret=2/0)

Program_SY_Maint.pvc

I'm not sure if i missed a table i should be adding this script under other then SO Header... Below is the script 

Date=" "

Lead=0

newDate=(d()+ "UDF_Calc_Days")

d=weekday(Date)

Select Case d

Case 1

document.write("Monday")

Case 2

document.write("Tuesday")

Case 3

document.write("Wednesday")

Case 4

document.write("Thursday")

Case 5

document.write("Friday")

End Select

retVal=oBusObj.GetValue("UDF_Calculated_Date$",Date)

retVal=oBusObj.GetValue("UDF_Calc_Days$",Lead)

retVal=oSession.FormatDate(Date,newDate,"%M/%D/%Y")

newDate=DateAdd("D",Lead,newDate)

newDate=oSession.GetFormattedDate(CStr(newDate))

retVal=oBusObj.SetValue("UDF_Calculated_Date$",newDate)

Any advise would be appreciated, thank you!