+ Reply to Thread
Results 1 to 8 of 8

Insert Lotus Notes Signature In Body Of Email Excel VBA

Hybrid View

  1. #1
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Insert Lotus Notes Signature In Body Of Email Excel VBA

    Hi All,

    We are currently using VBA to generate an email in Lotus Notes 8.5.3, and have run into the problem of the auto generated signature appearing before the body text. Forum Guru jaslake has offered much insight, but we havent been able to come up with a solution. An extensive google search also does not reveal a solution, even though this seems to be a pretty universal problem. Ive also had an open ticket with IT at IBM for the last month, but even though their service is very friendly, their concensus seems to be "Let us know when you find a solution".
    Any help with this problem would be greatly appreciated!
    Here is the current VBA:

    Sub LotusMail()
    'Control Q as shortcut
    ' Logic: Display email in Lotus Notes with attachment
    ' Conditions: Sends to a specific group of recipients,
                ' Subject heading is a static message and yesterdays date or Mondays date if current day is Monday,
                ' Displays static message or an extra message if current day is Friday,
                ' Displays signature
    
    Dim UserName As String ' the current users notes name
    Dim MailDbName As String ' the current users notes mail databse name
    Dim Recipient As Variant ' allows multiple email addresses to be added in an array
    Dim ccRecipient As Variant ' allows multiple email addresses to be added in an array
    Dim bccRecipient as Variant ' allows multiple email addresses to be added in an array
    Dim Attachment1 As String
    Dim Maildb As Object ' the mail database
    Dim MailDoc As Object ' the mail document itself
    Dim AttachME As Object ' the attachment richtextfile object
    Dim Session As Object ' the notes session
    Dim EmbedObj1 As Object
    Dim stSignature As String
    Dim notesUIDoc As Object ' Call workspace.EditDocument(True, MailDoc).GOTOFIELD("Body")
    
    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("stSignature")(0) ' Gets lotus sig
    
    ' Select range of e-mail addresses
    Recipient = Array("piercequality@excelforum.com", "piercequality@excelforum.com") 'declares multiple recipients
    ccRecipient = Array("piercequality@excelforum.com", "piercequality@excelforum.com") 'declares multiple  CC recipients
    bccRecipient = Array("piercequality@excelforum.com", "piercequality@excelforum.com") 'declares multiple BCC recipients
    MailDoc.SendTo = Recipient
    MailDoc.CopyTo = ccRecipient
    MailDoc.BlindCopyTo = bccRecipient
    
    
    If Weekday(Date, vbMonday) = 1 Then ' If current day is Monday
    business_day = Date - 3  ' Then business_day is Friday
    Else
    business_day = Date - 1 ' If current day is any other day, then business_day is yesterdays date
    End If
    business_day = (Format(business_day, " DD MMMM "))
    
    MailDoc.subject = "Daily Defects" & business_day ' Displays yesterdays date and Fridays date if Monday
    
    stSignature = Maildb.GetProfileDocument("CalendarProfile").GetItemValue("stSignature")(0) ' Gets lotus sig
    
    If Weekday(Date, vbMonday) = 1 Then ' If current day is Monday
    Friday_Text = "TGIM"  ' Then "TGIM" will display
    Else
    Friday_Text = "" ' If current day is any other day, then Fridays Text will not display
    End If
    MailDoc.body = "Hello World!" & vbCrLf & vbCrLf & Friday_Text & vbCrLf & vbCrLf & stSignature
    
    ' Select Workbook to Attach to E-Mail
    MailDoc.SaveMessageOnSend = True
    Attachment1 = "C:\Users\document.format" '"C:\YourFile.xls" ' Required File Name
    
    If Attachment1 <> "" Then
    On Error Resume Next
    Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment1")
    Set EmbedObj1 = AttachME.embedobject(1454, "Attachment1", "C:\Users\document.format") 'Required File Name
    On Error Resume Next
    End If
    
    
    'Displays email message without sending; user needs to click Send
    Set workspace = CreateObject("Notes.NotesUIWorkspace")
    
    Set notesUIDoc = workspace.EDITDocument(True, MailDoc)
        
         
    
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj1 = Nothing
    .ScreenUpdating = True
    .DisplayAlerts = True
    End With
    
    errorhandler1:
    
    
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj1 = Nothing
    
        
         
    End Sub

  2. #2
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: Insert Lotus Notes Signature In Body Of Email Excel VBA

    Bumping along

  3. #3
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: Insert Lotus Notes Signature In Body Of Email Excel VBA

    Bumping along

  4. #4
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: Insert Lotus Notes Signature In Body Of Email Excel VBA

    Bumping along

  5. #5
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: Insert Lotus Notes Signature In Body Of Email Excel VBA

    Bumping along

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Insert Lotus Notes Signature In Body Of Email Excel VBA

    Hi Pierce

    Take a look at this Thread in Post #4...there Signature Code included...http://www.excelforum.com/excel-prog...tus-notes.html
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  7. #7
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: Insert Lotus Notes Signature In Body Of Email Excel VBA

    Hello jaslake,

    I hacked the code from that thread into a fresh document and tossed my email address in it (instead of the range) and although it did send the email though lotus, unfoirtunately there was no signature again. :/
    Got me excited for a few minutes lol!

    Thanks!

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Insert Lotus Notes Signature In Body Of Email Excel VBA

    Hi Pierce

    You might want to PM the guy who wrote that Code, explain your issue and ask him to look at it...he seems to know how to work with Lotus Notes/Excel. Good hunting...keep me posted...I feel vested in this.

+ 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. Help - Attach an image from the userform into the body of an email in lotus notes
    By dragontm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2013, 05:35 AM
  2. Bold Text in Email body Lotus notes
    By TonyforVBA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-05-2011, 11:29 AM
  3. Automate Lotus Notes email with HTML body from excel
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-25-2010, 06:47 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] Body Text properties when sending email through Lotus Notes via Macro
    By PCLIVE in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2006, 11:15 AM

Tags for this Thread

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