Hello,
I have been using the VBA code below to attach the ACTIVE Excel file to the Lotus Notes email. I have recently created another macro that does a “file save as” function to save the ACTIVE Excel file as a PDF file. The macro below will not attach the ACTIVE PDF file… it gives me an error and stops at:
’Retrieve the path and filename of the active workbook.
stAttachment = ActiveWorkbook.FullName
I’m guessing I need to change the wording from “ActiveWorkbook.FullName” to something else because the active PDF is what I’d like to attach.
Any help is very much appreciated!
Thanks!
Lana
Sub SendEmail()
Dim noSession As Object, noDatabase As Object, noDocument As Object
Dim obAttachment As Object, EmbedObject As Object
Dim stSubject As Variant, stAttachment As String
Dim vaRecipient As Variant, vaMsg As Variant
Const EMBED_ATTACHMENT As Long = 1454
‘Retrieve the path and filename of the active workbook.
stAttachment = ActiveWorkbook.FullName
‘Initiate the Lotus Notes COM’s Objects.
Set noSession = CreateObject(“Notes.NotesSession”)
Set noDatabase = noSession.GETDATABASE(“”, “”)
‘If Lotus Notes is not open then open the mail-part of it.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL
‘Create the e-mail and the attachment.
Set noDocument = noDatabase.CreateDocument
Set obAttachment = noDocument.CreateRichTextItem(“stAttachment”)
Set EmbedObject = obAttachment.EmbedObject(EMBED_ATTACHMENT, “”, stAttachment)
vaRecipient = Range(“A3”)