I’m getting and error “TypeMismatch”. See belowCan someone look at this for me and make suggestions?
Sub Initialize
Dim s As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim maildoc As notesdocument
Dim rtitem As notesrichtextitem
'Dim copytoPeople(0 To 2) As String
Dim view As NotesView
Set db = s.CurrentDatabase
Set doc = s.DocumentContext
Set view = db.getview("ETTM")
Set doc = view.getfirstdocument
Do While Not doc Is Nothing
If doc.SendEmail = Y Then <------------ Right here I'm getting a Type Mismatch error.
Set maildoc = db.CreateDocument
'copytoPeople(0) = doc.LocalAreaExpert(0)
'copytoPeople(1) = ""
'copytoPeople(2) = ""
'copytoPeople(3) = doc.Email_1(0)
maildoc.form = "Memo"
maildoc.SendTo = doc.Email_1(0)
maildoc.SendTo = doc.Email(0)
'maildoc.CopyTo = copytoPeople
maildoc.subject = "Migration from Mail1/ Mail2 to xyz Notes Mail"
Set rtitem = New NotesRichTextItem(maildoc,"Body")
Call rtitem.appendtext("You have been identified as needing to be migrated to the Hospital Lotus Notes mail. To assist us we will need the following:")
Call rtitem.addnewline(1)
Call rtitem.appendtext("Your xyz Email ID and PASSWORD:")
Call rtitem.addnewline(2)
Call rtitem.AppendText("What do you use to check your e-mail? i.e. xyz Webmail, Outlook, Mozilla, Netscape, etc...")
Call rtitem.addnewline(2)
Call rtitem.AppendText("How do you check your xyz EMAIL? i.e. INotes or Lotus Notes Client.")
Call rtitem.addnewline(2)
Call rtitem.appendtext("Does your address book need to be migrated?.")
Call rtitem.AddNewline(2)
Call rtitem.AppendText("If we do not hear back from you in a timely manner your mail box will be converted without you input and closed accordingly.")
Call rtitem.AddNewline(2)
Call rtitem.AppendText("If you have questions or converns please contact somebody by e-mail at ")
Call rtitem.addnewline(1)
Call rtitem.AppendText("He can also be contacted at the VCUHS Help Desk for questions at ")
Call rtitem.AddNewline(2)
Call rtitem.AppendText("Thank You, xyz Lotus Support Team")
Call maildoc.Send(False)
End If
doc.SendEmail = "Done"
Call doc.Save(False, True)
Set doc = view.getnextdocument(doc)
Loop
Exit Sub
End Sub
Thanks!