CreateReplyMessage not working (error in debug)

I am trying to write an autorespnder for email. I cut and pasted the one out of help for the CreateReplyMessage but when I run it, I get a “Notes Item not found” error.

Below is the code:

Sub Initialize

Dim memo As NotesDocument

Dim reply As NotesDocument	





Set session = New NotesSession



Set db=session.CurrentDatabase



Set memo=session.DocumentContext

’ clientAddress = memo.From(0)

’ clientSubject = memo.Subject(0)

'…set value of memo…

If Not ( memo.SentByAgent ) Then

	Set reply = memo.CreateReplyMessage (False)

	reply.Subject = "Re: " & clientSubject

	reply.Body = "This is an automated reply"

	Call reply.Send( False )

End If  



Set session = Nothing

End Sub

If I run in debug it blows up at the “Set reply=” statement. The funny thing is, if I step into the agent down to that line then look at my variables tab and expand the memo field, IT WORKS!?!?!

Anybody have any idea why this is going on??

Thanks in advance