Link to home
Start Free TrialLog in
Avatar of Michael Williams
Michael WilliamsFlag for United States of America

asked on

Lotusscript to Create Memo while Passing Data from another Document

I have a button on a form that will pull some information from that document to a new memo. Unfortunately, it is placing the Body text below the email signature (All Users have a signature). Any ideas how I can get the text to appear above the signture?

	Dim wsUI As New NotesUIWorkspace
	Dim dbMail As New NotesDatabase( "", "" )
	Dim docMail As NotesDocument
	Dim vComputeForm As Variant
	
	Call dbMail.OpenMail
	
	Set docMail = dbMail.CreateDocument
	docMail.Form = "Memo"
	docMail.Subject = "Review the following: " + docUI.Document.IDNum(0)
	docMail.Body = |Hello,| + Chr(13) + Chr(13) +_
	|We have received your document, titled "| + docUI.Document.Title(0) + |."  We will review in a few days.| +_
	|Please feel free to contact our office with any questions.|
	
	Call wsUI.EditDocument( True, docMail )

Open in new window


The above codes output:

USER SIGNATURE

Hello,

We have received your document, titled "Title of Document."  We will review in a few days.

Please feel free to contact our office with any questions.
     

I would like the Body to look like the following:

Hello,

We have received your document, titled "Title of Document."  We will review in a few days.

Please feel free to contact our office with any questions.
      
USER SIGNATURE
Avatar of Michael Williams
Michael Williams
Flag of United States of America image

ASKER

I also tried the following and it didn't quite work out. It's missing the carriage returns.

	Dim wsUI As New NotesUIWorkspace
	Dim dbMail As New NotesDatabase( "", "" )
	Dim docMail As NotesDocument
	Dim vComputeForm As Variant
	
	Call dbMail.OpenMail
	
	Set docMail = dbMail.CreateDocument
	docMail.Form = "Memo"
	docMail.Subject = "Review & Comment Hearing for Initiative " + docUI.Document.ElectionCycle(0) + " #" + docUI.Document.Idnumber(0)
	
	Dim sBodyText As Variant
	sBodyText = |Hello,| + Chr(13) + Chr(13) +_
	|We have received your document, titled "| + docUI.Document.Title(0) + |."  We will review in a few days.| + Chr(13) + Chr(13) +_
	|Please feel free to contact our office with any questions.|
	
	Dim tempuidoc As NotesUIDocument
	Set tempuidoc=wsUI.EditDocument(True, docMail) 
	Call tempuidoc.GotoField("Body")
	Call tempuidoc.SelectAll
	Call tempuidoc.Copy
	Call tempuidoc.Clear
	Call tempuidoc.InsertText( sBodyText )
	Call tempuidoc.Paste

Open in new window


The above codes output:

Hello,We have received your document, titled "Title of Document."  We will review in a few days.Please feel free to contact our office with any questions.
     
USER SIGNATURE
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome. Thank you very much.

In ended up using:
     Dim CrLf as String
     CrLf = Chr$(10) + Chr$(10)