Search code examples
lotusscriptlotus

variant doesn't contan an object, lotus script


I am writing this lotus scritp and I cannot figure the error out the error is variant doen't contain an object... It will be appreciated if anyone can help Thanks in advance

Sub Click(Source As Button)
Dim session As New NotesSession 

Dim ws As NotesUIWorkspace
Dim adminp As NotesAdministrationProcess
Dim userName As Variant

userName = workspace.Prompt(PROMPT_OKCANCELEDIT, _
"User", _
"Enter the user to delete")

noteID$ = adminp.DeleteUser( userName , False , DelMailFile , "Terminations" , False )


End Sub

Solution

  • You are not initializing your UI workspace variable ws so initialize it with New:

    Dim ws As New NotesUIWorkspace
    

    Also, you are then calling Prompt on a variable called workspace which should be changed to ws as that is the name of your declared variable:

    userName = ws.Prompt(...
    

    Also, you are not initializing the adminp variable so do something like this before calling adminp.DeleteUser():

    Set adminp = session.CreateAdministrationProcess("Server/Org")
    

    Finally you are referring to a variable called DelMailFile which is not declared. So make sure to declare it or use the proper integer value as defined in the help for DeleteUser.