Lotus Notes to Outlook (1 Viewer)

Prayder

Registered User.
Local time
Today, 08:59
Joined
Mar 20, 2013
Messages
303
I have a current db that uses Lotus Notes to send out emails. We have recently changed over to outlook and are needing to change the vba code to reflect outlook instead of Lotus notes. I have tried for 3-4 weeks to understand it and do it myself but I am a network and pc guy not a programming guy. Is there someone I can pay or somewhere I can go to have this done? I am on a deadline here.
 

namliam

The Mailman - AWF VIP
Local time
Today, 15:59
Joined
Aug 11, 2003
Messages
11,695
If you want someone to come help you sure I can IF you are in the NL someplace, preferably amsterdam e.o.

Might be nice if you need the (hired) help to
- Give a location even country where you are at.
If you want help on the forum
- What you have tried that doesnt work
- what it is you get stuck on
 

Prayder

Registered User.
Local time
Today, 08:59
Joined
Mar 20, 2013
Messages
303
I am actually in the United States in Arkansas.

I have found code that is used to open outlook and so forth but I dont know vba well enough to know where the outlook code goes in place of the lotus notes code. We have order forms that have a rush check box and when checked... it emails the person set up as the approver. the code checks to see if lotus notes is running and then sends the email... I am totally lost on where to actually start looking at the code....
 

Prayder

Registered User.
Local time
Today, 08:59
Joined
Mar 20, 2013
Messages
303
There is a module in the Db called Lotus Email and here is that code:

Code:
Option Compare Database
Option Explicit
Public mobjDB As Object
Public Const Parters = 1
Public Const Approvers = 2

'this sub will: output a report as a file
'attach the file and add the predetermined subject and body
'email the designated person for that type of message
'delete the file that was output
'close the session with the server
Public Function SEND_EMAIL(ByVal ReportName As String, Subject As String, RecipientList As Integer, message As String) As Boolean
    'open the session with the lotus notes server
    SEND_EMAIL = True
    
    If OPEN_SESSION Then
    
        'output report to text file on C:\
'        DoCmd.OutputTo acOutputReport, ReportName, acFormatRTF, "C:\tempreport.rtf", False
        DoCmd.OutputTo acOutputReport, ReportName, acFormatTXT, "C:\tempreport.txt", False
'       DoCmd.OutputTo acOutputReport, ReportName, acFormatXLS, "C:\tempreport.xls", False
'        DoCmd.OutputTo acOutputReport, ReportName, acFormatHTML, "C:\tempreport.html", False
        Dim EmailTo As String
                
        'send mail to appropriate address
        If RecipientList = Parters Then
            EmailTo = Get_Email_for_Type("ReqPart")
        Else
            EmailTo = Get_Email_for_Type("ReqApp")
        End If
        
        If IsNull(EmailTo) Then
            SEND_EMAIL = False
        Else
            SEND_EMAIL = EMAIL_REPORT(EmailTo, message, Subject, "C:\tempreport.txt")
'            SEND_EMAIL = EMAIL_REPORT(EmailTo, message, Subject, "C:\tempreport.xls")
 '           SEND_EMAIL = EMAIL_REPORT(EmailTo, message, Subject, "C:\tempreport.html")
        End If
                
        'delete the file
        Kill ("C:\tempreport.txt")
        
        'call the close session sub to destroy the objects
        CLOSE_SESSION
    
    Else
        SEND_EMAIL = False
    End If
End Function
'unused, left for potential future use
Private Function SEND_MULTIPLE_EMAILS(strSendTo() As String, strBody As String, strSubject As String, Optional strFile As String) As Boolean
    SEND_MULTIPLE_EMAILS = True
    Dim SendOne As Variant
    For Each SendOne In strSendTo
        SEND_MULTIPLE_EMAILS = SEND_MULTIPLE_EMAILS And _
            EMAIL_REPORT((SendOne), strBody, strSubject, strFile)
    Next
End Function
Private Function Get_Email_for_Type(strType As String) As String
    Get_Email_for_Type = DLookup("[Email]", "[NotifyEmails]", "[Type] = '" & strType & "' AND Active = -1")
End Function
Public Function OPEN_SESSION() As Boolean
Dim objSession As Object
Dim strServer As String
Dim strMailFile As String
'lotus notes must be open for module to work correctly
If MsgBox("Do you have Outlook running?", vbCritical + vbYesNo, "Warning!") = vbYes Then
'this code must be left out of the loop so that only one session is started
Set objSession = CreateObject("Notes.NOTESSESSION")
strServer = objSession.GETENVIRONMENTSTRING("mailserver", True)
strMailFile = objSession.GETENVIRONMENTSTRING("mailfile", True)
Set mobjDB = objSession.GETDATABASE(strServer, strMailFile)
OPEN_SESSION = True
Else
MsgBox "Please start Outlook and try again.", vbOKOnly, "Emails"
OPEN_SESSION = False
End If
End Function
Public Function EMAIL_REPORT(strSendTo As String, strBody As String, strSubject As String, Optional strFile As String) As Boolean
On Error GoTo EmailReport_Err
Dim objDoc As Object
Dim objRichTextAttach As Object
Dim objRichTextItem As Object
Dim objAttachment As Object
Const NOTES_RECIPIENTS = ""
Const NOTES_REPORTS_USER = ""
Const NOTES_MAIL_FILE = "C:\Email.txt"
Set objDoc = mobjDB.CREATEDOCUMENT
Set objRichTextAttach = objDoc.CREATERICHTEXTITEM("File")
Set objRichTextItem = objDoc.CREATERICHTEXTITEM(objDoc, "Body")
If strFile <> "" Then
Set objAttachment = objRichTextAttach.EMBEDOBJECT(1454, "", strFile)
End If
'set up the email to be sent
objRichTextItem.AppendText strBody
objDoc.REPLACEITEMVALUE "SendTo", strSendTo
objDoc.REPLACEITEMVALUE "Subject", strSubject
objDoc.SaveMessageOnSend = True 'send E-mail
objDoc.SEND False 'false for do not attach a form
EMAIL_REPORT = True
Exit_Here:
Set objAttachment = Nothing
Set objDoc = Nothing
Set objRichTextAttach = Nothing
Set objRichTextItem = Nothing
Exit Function
EmailReport_Err:
EMAIL_REPORT = False
Resume Exit_Here
End Function
Public Sub CLOSE_SESSION()
Set mobjDB = Nothing
End Sub
 

namliam

The Mailman - AWF VIP
Local time
Today, 15:59
Joined
Aug 11, 2003
Messages
11,695
pft perhaps someone with more outlook / lotus knowledge can help you in more detail, atleast without being able to test (on site) my knowledge of actually emailing drops short too
 

tonez90

Registered User.
Local time
Today, 23:29
Joined
Sep 18, 2008
Messages
42
I used to use Lotus notes and its not to dissimilar to outlook coding.

Anyway here is a module I tend to use - its full of outlook type stuff and hopefully you can follow it. Most are relatively strait forward.

Tonez
 

Attachments

  • Mod_Mail.txt
    65.3 KB · Views: 83

Users who are viewing this thread

Top Bottom