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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Lotus Note with Excel Attachment in VBA

Status
Not open for further replies.

batteam

Programmer
Sep 12, 2003
374
US
I want to send a Lotus Note with VBA with an Excel file as an attachment. I can do this easily with the code below, (varPath is my path and name) but my task is to attach an Excel file that is created just before the Note is sent, without saving the Excel file in a folder. When the Note is created and sent, the Excel file to be attached is still shown on the screen (will always be named Book1.xlsx by default, I believe). Can this be done WITHOUT first saving the Excel file to a shared folder location? Bottom line: I need to define "attachment1" in the below code as just an Excel Object that is currently open.

Dim objNotes As Object
Dim objNotesDB As Object
Dim objNotesMailDoc As Object
''*******************************
Dim attachment1 As String
Dim AttachME As Object
Dim embedObj1 As Object
''************************************


Set objNotes = GetObject("", "Notes.Notessession")
Set objNotesDB = objNotes.GetDatabase("", "")

Call objNotesDB.OPENMAIL
Set objNotesMailDoc = objNotesDB.CreateDocument
''********************************************************************
attachment1 = varPath
Set AttachME = objNotesMailDoc.CreateRichTextItem("attachment1")
Set embedObj1 = AttachME.EmbedObject(1454, "attachment1", varPath, "")
''**********************************************************************


Call objNotesMailDoc.ReplaceItemValue("SendTo", strRecipient)
Call objNotesMailDoc.ReplaceItemValue("CopyTo", strCCRecipient)
Call objNotesMailDoc.ReplaceItemValue("Subject", strSubj)
Call objNotesMailDoc.ReplaceItemValue("Body", strBody)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top