+ Reply to Thread
Results 1 to 20 of 20

Email through Lotus Notes After cell change

  1. #1
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Email through Lotus Notes After cell change

    Excel gods I need some help.

    I am looking to build a macro that can automatically email a recipient upon their name being selected from a drop down list. It designed to be for a warehouse, so when new packages come in we can scan them in and have excel send an email out once our receiving team determines who it is for. With their being multiple recipients, I would like the code to have an IF type function that choosing the correct recipient. the Column titles "Recipient/Dept" is where the dropdown list is located.

    In my head it would be ideal for the code to just utilize an open Lotus Notes Session and use that to send the email. Attached is the document with what I have thus far.
    Any and all help is greatly appreciated.

    -DasBurgers

    Warehouse barcode test.xlsm

  2. #2
    Registered User
    Join Date
    02-20-2014
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Email through Lotus Notes After cell change

    Hi DasBurgers,

    I would suggest taking a look at Ron DeBruin's website - his site contains loads of great mail macros for both Lotus Notes and Outlook.
    There will definitely be something there you can use/adapt for your purposes.

    http://www.rondebruin.nl/win/s1/notes/notes.htm

    If you are still stuck once you have had a look at this page, I have some experience with using Ron's code for Notes and can probably pull together some code for you.

  3. #3
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    Perfect!! Thanks a bunch for the info and will give the website a look to make another few attempts at it. If I have issues I'll come back here. Thanks again for your quick response.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Email through Lotus Notes After cell change

    See if this is something you can work with. You'll have to modify it for your needs. When a selection is made from the dropdown an email is sent.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    ^^ Works absolutely fantastic!! Just one more question.

    I am looking to have a selected range in the body of the email with each email sent. Not just a set range but the data, to the left, adjacent to the name selected in the drop down list.

    I am assuming it is going to be something along these lines, with some type of IF function or OFFSET to select the respective row and columns to the left of the name.

    rnBody.Copy
    Set Data = New DataObject
    Data.GetFromClipboard


    Again your help is greatly appreciated. Rep for all who help!!

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Email through Lotus Notes After cell change

    Does this help?

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    perfect thanks so much....apologizies again for the onslaught of PMs lol

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Email through Lotus Notes After cell change

    You're welcome. Glad to help out and thanks for the feedback. Please comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

  9. #9
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    Will do. Running into an issue. I have added another column for the carrier and using your suggested MailDoc.Body code works for the Carrier but not the Tracking number. It uses the date as the tracking number, seems as though it is looking the column over 3 for both but I checked and it is set to -2 & -3.

    Does this issue have to do with the time stamp sub I have in the beginning?

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim x As Long
    x = Sheets("Recipients").Range("A" & Rows.Count).End(3).Row
    If Target.Column = 2 And Target.Offset(0, 2).Value = "" Then
    Target.Offset(0, -1) = Format(Now(), "mm/dd/yy")
    End If
    If Not Intersect(Target, Columns(4)) Is Nothing Then
    Target.Offset(, 1).Formula = "=VLOOKUP(D" & Target.Row & ",Recipients!$A$2:$B$" & x & ",2,false)"
    End If

    Dim UserName As String
    Dim MailDbName As String
    Dim Recipient As Variant
    Dim ccRecipient As String
    Dim Attachment1 As String
    Dim Maildb As Object
    Dim MailDoc As Object
    Dim AttachME As Object
    Dim Session As Object
    Dim EmbedObj1 As Object
    Dim stSignature As String

    With Application
    .ScreenUpdating = False
    .DisplayAlerts = False

    ' Open and locate current LOTUS NOTES User

    Set Session = CreateObject("Notes.NotesSession")
    UserName = Session.UserName
    MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
    Set Maildb = Session.GetDatabase("", MailDbName)
    If Maildb.IsOpen = True Then
    Else
    Maildb.OPENMAIL
    End If

    ' Create New Mail and Address Title Handlers

    Set MailDoc = Maildb.CREATEDOCUMENT

    MailDoc.Form = "Memo"

    stSignature = Maildb.GetProfileDocument("CalendarProfile").GetItemValue("Signature")(0)


    ' Select range of e-mail addresses
    Recipient = Array("", Target.Offset(, 1).Value)
    MailDoc.SendTo = Recipient
    MailDoc.Subject = "Package Received Under Your Name/Dept"
    MailDoc.Body = "The Date is " & Target.Offset(, -3) & vbCrLf & "The Tracking No. is " & Target(, -2) & vbCrLf & "The Carrier is " & Target(, -1) & vbCrLf & vbCrLf & stSignature

    ' Select Workbook to Attach to E-Mail

    MailDoc.SaveMessageOnSend = True


    MailDoc.PostedDate = Now()
    On Error GoTo errorhandler1
    MailDoc.SEND 0, Recipient

    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj1 = Nothing

    .ScreenUpdating = True
    .DisplayAlerts = True
    End With

    errorhandler1:

    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj1 = Nothing
    MsgBox "The e-mail has successfully been created and distributed.", vbInformation

    End Sub

  10. #10
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    Ignore^^^^ Was able to figure it out. However, my msgbox is popping up twice everytime. What could be the cause of this?

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Email through Lotus Notes After cell change

    Place your msgbox above errorhandler1:

  12. #12
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    still apearing twice

  13. #13
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Email through Lotus Notes After cell change

    Above this line:

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change


  15. #15
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    Being new to the forum, I really really appreciate all your help John H. Davis. Whether assistance with the coding itself or informing me of the rules on the forums, it is all greatly appreciated, especially your paitence with me.

  16. #16
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Email through Lotus Notes After cell change

    I can't figure it out either. Perhaps someone else may be able to help.

  17. #17
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Email through Lotus Notes After cell change

    Quote Originally Posted by DasBurgers View Post
    Being new to the forum, I really really appreciate all your help John H. Davis. Whether assistance with the coding itself or informing me of the rules on the forums, it is all greatly appreciated, especially your paitence with me.
    You're welcome. The Forum is where I picked up most of my knowledge about VBA. Sorry, I can't help further with the double msgbox. I just don't have any idea.

  18. #18
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Email through Lotus Notes After cell change

    Place it here and it works only once.

    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    Quote Originally Posted by JOHN H. DAVIS View Post
    You're welcome. The Forum is where I picked up most of my knowledge about VBA. Sorry, I can't help further with the double msgbox. I just don't have any idea.
    No worries, you have been a tremendous help already. I hope to learn as much as you through this forum!!!

  20. #20
    Registered User
    Join Date
    07-28-2014
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    39

    Re: Email through Lotus Notes After cell change

    Quote Originally Posted by JOHN H. DAVIS View Post
    Place it here and it works only once.




    If Not Intersect(Target, Columns(4)) Is Nothing Then
    Target.Offset(, 1).Formula = "=VLOOKUP(D" & Target.Row & ",Recipients!$A$2:$B$" & x & ",2,false)"
    MsgBox "The e-mail has successfully been created and distributed."
    End If
    PERFECT!!!! Answered all of my questions beautifuly. Thanks again for taking the time out to help!!
    Last edited by DasBurgers; 08-19-2014 at 02:46 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to send email using lotus notes based upon cell value
    By jt1672 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-28-2013, 07:15 AM
  2. VBA CODE To Change Lotus Notes Email Body To Calibri Size 11
    By FLani in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2013, 12:24 AM
  3. Loop cell to create PDF and send as email in lotus notes
    By Mark Brown in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2011, 06:12 PM
  4. Send cell range to the body of a Lotus Notes email
    By Rob0405 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-09-2009, 05:46 AM
  5. [SOLVED] Why won't AOL email communicate with lotus notes email?
    By ManInaMaze in forum Excel General
    Replies: 0
    Last Post: 08-02-2005, 10:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1