Error 176: Expression out of range

HI all,

I am trying to coding a error handling in my agent using Lotus Script, but it is giving the following error:

176: Expression out of range

Module: ENVIAMAIL, Line: 22

Module: ENVIARSOLICITACAOPTALOCAL, Line: 38

The Module ENVIAEMAIL that I am using is:

Sub EnviaMail(Destinatarios As Variant, Assunto As String, Mensagem As String)

Dim Sessao As New NotesSession     

Dim Db As NotesDatabase     

Dim DocMail As NotesDocument

Dim RichText As NotesRichTextItem

Dim logDoc As NotesDocument



On Error Goto ErrorThrower





Set Db = Sessao.CurrentDatabase

Set DocMail = New NotesDocument(Db)     

DocMail.Form = "Memo"

DocMail.SendTo = Destinatarios

DocMail.Subject = Assunto	

Set RichText = New NotesRichTextItem(DocMail, "Body")

Call RichText.AppendText(Mensagem)		

Call DocMail.Send(False)

ErrorThrower:

Error Err, Error & Chr(13) + "Module: " & Cstr( Getthreadinfo(1) ) & ", Line: " & Cstr( Erl )

End Sub

Could you help me please?

Seems that the error is on line:

Error Err, Error & Chr(13) + "Module: " & Cstr( Getthreadinfo(1) ) & ", Line: " & Cstr( Erl )

Thanks,

Rafael

Subject: Error 176: Expression out of range

Hi!I have managed to cope with this error by adding an “If … then” instruction and putting the error message inside of it. The error does not show up when you use this code:

If Err > 0 Then

Error Err, Error & Chr(13) + "Module: " & Cstr( Getthreadinfo(1) ) & ", Line: " & Cstr( Erl )

End If

It seems that lack of error causes the error message :slight_smile: