r/ASPNET • • Jul 27 '11

Using procedures to set variables

I'm using ASP to create a system for some schoolwork, and part of the system is sending an email notification - I'm using the following code to do this:

Set AbsenceNotification=CreateObject("CDO.Message")
AbsenceNotification.Subject=call AbsenceReasonVerbose(AbsenceType)
AbsenceNotification.From="Cover System <cover@internet.com>;"
AbsenceNotification.To="Me <Me@internet.com>;"
AbsenceNotification.To=call find_emailaddress_string(Subject,AbsenceType)
AbsenceNotification.TextBody="Message, Message, Message"
AbsenceNotification.Send
set AbsenceNotification=nothing

However, I get a syntax error on the lines which call procedures, i.e., AbsenceNotification.Subject=call AbsenceReasonVerbose(AbsenceType)

Am I doing it right?

Thanks in advance reddit :)

2 Upvotes

8 comments sorted by

View all comments

Show parent comment

6

u/waller87 Jul 27 '11

try something like this

Public Function AbsenceReasonVerbose(ByVal AbsenceType As String) As String
        Select Case AbsenceType
        Case "Inset"
        Return "CF1 - Professional Absence"
        Case "MedicalPersonal"
        Return "CF2 - Personal Absence"
        Case "SchoolTrip"
        Return "CF3 - Educational Visit"
    End Select
End Function