@Command([FileExport]) and NotesUIDocument

Hello. If anybody has a minute, I am attempting to export notes records to individual rtf files (one notes doc = one rtf file) in a batch job. I am trying to jerry-rig an agent to loop through a view, sequentially obtain handles on each doc and uidoc (via workspace.EditDocument)…and trigger an agent that uses @Command( [FileExport] ; fileType ; fileName )…

Set doc1=view.GetFirstDocument

While Not doc1 Is Nothing

Set doc2=view.GetNextDocument(doc1)



Set uidoc = workspace.EditDocument( True, doc1 )

Call agent.Run

Call uidoc.Close

Set doc1=doc2

Wend

The problem is I receive an ‘@Function cannot be used in this context’ error.

When i comment out the Call agent.Run line and throw the @Command( [FileExport] ; fileType ; fileName ) into the Postopen event on the form, the jerry-rig works. Is there a way to avoid messing with the form event and somehow getting this to work within the scope of the agent? Thank you very much for your time.