• Activate Outlook from within Access?

    Author
    Topic
    #351689

    I am looking at designing an application to track project issues. The Application would be built in Access. What I am wondering is whether or not there is a way to put some of the “Issue” information into an Outlook mail message and post it to the Project Manager, every time an new issue is entered. Is there some way of activating a VBA script that would do this? Any insight, help is appreciated. Thanks.

    Ron M

    Viewing 2 reply threads
    Author
    Replies
    • #509785

      The simple answer is “Yes”, but what are you actually trying to accomplish besides drive the Project Manager crazy with e-mails? How often would you expect this to take place? If it happens frequently, you might be better advised to log it into a file and let the Project Manager check the log at intervals.

      • #509852

        The object is not to drive the PM crazy, but to nag him a bit. Since these are relatively small projects, I don’t anticipate more than one or two “issues” a day on a bad day — on larger projects, you are right, you would drive him crazy with e-mails and I agree, it would be better to log to a file and have him check the log at intervals. I was interested in whether it could be done and how one might do it.

        Ron M

        • #509866

          I’ve done it to external addresses using Outlook and Exchange Server, but there’s another alternative as well.

          Reference Point Software has a product called SendMail which allows you to use Access to send a message across a network through an SMTP server. You can also contact them at info@ReferencePointSoftware.com.

          This method is faster than using Outlook since it doesn’t have to load the email program at all, and it was designed for exactly what you’re trying to do.

          If SendMail doesn’t suit you, post again and I’ll find the code I used. or maybe someone else has some they’ll post in the meanwhile.

    • #509874

      Hi

      I developed a class module to send mails. Comments are in dutch, but the coding speaks for itself:

      Option Compare Database
      Option Explicit
      ‘*******************************************************
      ‘Class clsMAPI
      ‘*******************************************************
      ‘Algemene declaraties voor een email object.
      ‘*******************************************************
      Dim objMySes As Object ‘Session object voor de MAPI sessie

      Public Function SendMail(txtMailTo As String, Optional txtText As String, Optional txtSubject As String) As String
      ‘*******************************************************
      ‘Functie voor het versturen van een mailtje.
      ‘De returnwaarde is een string.
      ‘Als de string leeg is is de toevoeging succesvol geweest.
      ‘Als de string niet leeg is, dan bevat de string een
      ‘foutboodschap.

      ‘LAATSTE WIJZIGING:
      ‘ Versie 1.0 augustus 2000 B. Stam
      ‘ Initiele versie van de functie
      ‘*******************************************************
      If gTrace Then
      Debug.Print “clsMAPI SendMail”
      Else
      On Error GoTo ErrorHandler
      End If

      Dim strMessage As String
      Dim objRecip As Object
      Dim objMes As Object

      ‘*******************************************************
      ‘Ontvanger is verplicht.
      ‘*******************************************************
      If txtMailTo = “” Then
      strMessage = “The recipient of the mail is not valid or not given!”
      GoTo ExitFunction
      End If

      ‘*******************************************************
      ‘Niet ingevulde parameters afhandelen.
      ‘*******************************************************
      If IsMissing(txtText) Then
      txtText = “”
      End If
      If IsMissing(txtSubject) Then
      txtSubject = “”
      End If

      ‘*******************************************************
      ‘De boodschap zelf invullen.
      ‘*******************************************************
      Set objMes = objMySes.Inbox.Messages.Add
      With objMes
      .Text = txtText
      .Subject = txtSubject
      End With

      ‘*******************************************************
      ‘De ontvanger invullen
      ‘*******************************************************
      Set objRecip = objMes.Recipients.Add
      With objRecip
      .Name = txtMailTo
      .Resolve
      ‘.Send
      End With

      ‘*******************************************************
      ‘En nog even versturen.
      ‘*******************************************************
      objMes.Update
      objMes.Send ShowDialog:=False

      ExitFunction:
      If strMessage “” Then
      SendMail = strMessage
      Else
      SendMail = “”
      End If
      Exit Function

      ErrorHandler:
      SendMail = Chr(10) & Chr(13) & “Errornumber: ” & CStr(Err.Number) & ” ”
      SendMail = SendMail & “Errormessage: ” & Err.Description
      Exit Function
      End Function

      Private Sub Class_Initialize()
      ‘*******************************************************
      ‘Bij het instantieren van het object een MAPI sessie
      ‘openen.
      ‘Let op de profilename is afhankelijk van het mail
      ‘programma dat gebruikt wordt.
      ‘Als profilename weggelaten wordt, dan wordt er, indien
      ‘noodzakelijk, automatisch om gevraagd.
      ‘*******************************************************
      If gTrace Then Debug.Print “clsMAPI Class_Initialize”
      Set objMySes = CreateObject(“MAPI.Session”)
      If Not objMySes Is Nothing Then
      objMySes.Logon ‘Als profilename niet gegeven hoeft te worden.
      ‘objMySes.Logon profileName:=”Microsoft Exchange”
      End If

      End Sub

      Private Sub Class_Terminate()
      ‘*******************************************************
      ‘Als het object verwijderd wordt ook de MAPI sessie
      ‘verwijderd.
      ‘*******************************************************
      If gTrace Then Debug.Print “clsMAPI Class_Terminate”
      objMySes.Logoff
      End Sub

      Bart
      Software designer

      • #509985

        Thanks to you both. I appreciate your help with this. Charlotte, I will do some further investigation on the Send Mail product, in the meantime, if you wouldn’t mind posting the code you mentioned. Again many thanks for the help and insight of you both.

        Ron M

    • #510474

      Ron – No one seemed ask what, if anything you are using to manage your projects. If you are using MS Project, as more and more people are, you may want to take advantage of the built-in workgroup features, or Project Central.

      Definately worth looking at to save you from reinventing the wheel.

      Just a thought.

      Rich P.

      • #510523

        Thanks Rich. I will look into it.

        Ron M

    Viewing 2 reply threads
    Reply To: Activate Outlook from within Access?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: