Macro & Lotus Notes

Mikec1012

New Member
Joined
Oct 24, 2017
Messages
30
Hello there!
 
I have pieced together several macros and I am almost good to go with my project. However, the macro I need help with is the actual sending the mail. The script I found, would generate a pop up and could use that to enter in an email address. However, I'd like to remove the pop up and have it reference a specific cell. At my job, we can send emails with a 5 digit employee ID number. So part of the macro is set to auto fill K2 with the EID (employee ID); however, not sure how to get the code to reference the cell.
 
Here's my code:
The following pertains to sending the email with attachment
'Get the name of the recipient from the user.
'Do
' vaRecipient = Application.InputBox( _
' PROMPT:=" *** Enter the EID you are sending the report to *** ")
' Loop While vaRecipient = ""

'If the user has canceled the operation.
'If vaRecipient = False Then Exit Sub

'Get the message from the user.
Do
vaMsg = Application.InputBox( _
PROMPT:="Who does the report belong to:")
Loop While vaMsg = ""

'If the user has canceled the operation.
If vaMsg = False Then Exit Sub

'Add the subject to the outgoing e-mail which also can be retrieved from the users
'in a similar way as above.
stSubject = vaMsg & ", here is your K08 Report for " & Format(Date, "mm/dd/yy")

'Retrieve the path and filename of the active workbook.
stAttachment = ActiveWorkbook.FullName

'Instantiate 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)

'Add values to the created e-mail main properties.
With noDocument
.Form = "Memo"
.SendTo = Range("L2")
.Subject = stSubject
.Body = "Here is your K08 report " & vaMsg & "! Blood, sweat and tears went into compiling this for you. Jk! I clicked one button."
.SAVEMESSAGEONSEND = True
End With

'Send the e-mail.
' With noDocument
' .PostedDate = Now()
' .SEND 0, Range("K2")
' End With

'Release objects from the memory.
Set EmbedObject = Nothing
Set obAttachment = Nothing
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing

'Activate Excel for the user.
AppActivate "Microsoft Excel"

MsgBox "The e-mail has successfully been created and distributed.", vbInformation
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top