Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasting into Lotus email via VB

Status
Not open for further replies.

MikeCDPQ

Technical User
Sep 11, 2003
173
CA
Hi,

I have a VB script that creates and excel spreadsheet saves it and then sends it as an attachment throught Lotus notes.

I would like to know how I could, instead of creating an attachment, paste special as Excel Worksheet into the body of the email.

The script works perfectly and sample below was stipped of any extras for sake of clarity.

Here is how my email is created:


Const EMBED_ATTACHMENT = 1454

Set session = CreateObject("Notes.NotesSession")
Set Db = session.GetDatabase("", "")
Call Db.OpenMail

Set Doc = Db.CreateDocument

Call Doc.ReplaceItemValue
Call Doc.ReplaceItemValue("SendTo", Recipient)
Call Doc.ReplaceItemValue("Subject", ReportName)
Set rtitem = Doc.CreateRichTextItem("Body")
Call rtitem.AppendText(MSG1)
Call rtitem.EmbedObject(EMBED_ATTACHMENT, "", Attachment)
Call rtitem.AppendText(Msg2)
Doc.SaveMessageOnSend = True
Call Doc.Send(False)
Set session = Nothing

End Sub


Thanks for any suggestion.

Mike
 
There is an EMBED_OBJECT option for your code. Try that instead of EMBED_ATTACHMENT and see if it does what you want.

Pascal.
 
I had tried that but not quite sure on how to use it and the help in VB being what it is, I never really found out.


I replace the line from:
Call rtitem.EmbedObject(EMBED_ATTACHMENT, "", Attachment)
to
Call rtitem.EmbedObject(EMBED_OBJECT, "", Attachment)

and I get:

Run-time error 7223
Invalide embedding type

ATTACHMENT refers to MYPATH & MYFILENAME.xls

Any more suggestions ??

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top