Problem "Type Mismatch" can somwone look at this for me

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!

Subject: Problem “Type Mismatch” can somwone look at this for me.

Try

If doc.SendEmail(0) = “Y” Then

Subject: RE: Problem “Type Mismatch” can somwone look at this for me.

Matt-That worked Thanks! I would ask you or anyone else I’m trying to loop through the view and mark each document as it processed. However, it just grabs the first document and processes it then does the next one 5 minutes later etc. I want them to process all at once do you see a problem in my logic with respect to that?

Thx

Tom

Subject: RE: Problem “Type Mismatch” can somwone look at this for me.

Matt-That worked Thanks! I would ask you or anyone else I’m trying to loop through the view and mark each document as it processed. However, it just grabs the first document and processes it then does the next one 5 minutes later etc. I want them to process all at once do you see a problem in my logic with respect to that?

Thx

Tom

Subject: RE: Problem “Type Mismatch” can somwone look at this for me.

Your process of getting a view document, process it, save it and get next document of the view will take a bit of time as the view index update each time you save a document. Instead, if you use documentcollection, and loop thru the documents, it will be a bit faster. If you use NotesViewEntryCollection class and get the collection and loop thru it, this will even be more faster.------------------------------------------------

You can remove the line —> set doc = s.documentcontext.

Use viewentrycollection for faster processing.

dim vc as NotesViewEntryCollection

dim e as NotesViewEntry

set vc = view.AllEntries

set e = vc.GetFirstEntry()

If not e is nothing then

do until e is nothing

   set doc = e.Document

   ...process document and send email

   ...mark document as processed & save it

   set e= vc.GetNextEntry(e)

loop

end if

Subject: RE: Problem “Type Mismatch” can somwone look at this for me.

Oops. Never mind. duplicate post.

Subject: RE: Problem “Type Mismatch” can somwone look at this for me.

Oops. Never mind. duplicate post.