/ Forums / Advansys Formativ / Creating Solutions with Formativ / GroupWise Account CategoryDefinitions Add / Reply To: GroupWise Account CategoryDefinitions Add

#7898
dgerisch
Participant

    I’m getting an error, and I don’t know why. The error I get is:

    CategoryDefinition.Object
    An invalid argument was passed in the function call. at line 19, column 5

    Sub Main(Client, GWEvent)

    Const CATEGORY_CODE_FILE = “CategoryList.txt”
    DEFAULTFOLDER = Utilities.GetDataDirectory

    iFilePath = DEFAULTFOLDER & CATEGORY_CODE_FILE
    set iCodeList = Utilities.StringList
    set iFSO = CreateObject(“Scripting.FileSystemObject”)

    If iFSO.FileExists(iFilePath) then
    iCodeList.LoadFromFile(iFilePath)
    End if

    For x = 0 to iCodeList.count – 1
    GroupWise.Account.CategoryDefinitions.Add(iCodeList.strings(x))
    Next

    Set iCodeList = Nothing

    End Sub

    Line 19 is the GroupWise.Account.CategoryDefinitions.Add(iCodeList.strings(x)) line.

    I know for certain that the file exists, because if I put a msgbox inside the If iFSO.FileExists(iFilePath) block, I do get a pop up that tells me this test was met.

    I’m guessing that there is something different between a bunch of iCodeList.Add(“”) statements and iCodeList.LoadFromFile(), but I don’t know what it is.

    Thank you for any pointers you can send me.