[AccessD] Email problem. Again

Max Wanadoo max.wanadoo at gmail.com
Wed Mar 3 05:22:19 CST 2010


Here is the SENDOJECT examples - uses ClickYes, but this is not necessary if
you are happy for the user to click the send button or preview the email.

Max

Option Compare Database
Option Explicit
' Declare Windows' API functions
Private Declare Function RegisterWindowMessage _
                          Lib "User32" Alias "RegisterWindowMessageA" _
                              (ByVal lpString As String) As Long
Private Declare Function FindWindow Lib "User32" _
                                    Alias "FindWindowA" (ByVal lpClassName
As Any, _
                                                         ByVal lpWindowName
As Any) As Long
Private Declare Function SendMessage Lib "User32" _
                                     Alias "SendMessageA" (ByVal hwnd As
Long, _
                                                           ByVal wMsg As
Long, ByVal wParam As Long, _
                                                           lParam As Any) As
Long
Public Function pfSendUsingObject()
    Dim bPreview As Boolean
    'if you do want to preview then you do not need the ClickYes stuff.
    ' but if you don't want to preview and you just want to send it without
being informed that
    ' it is being sent, then use the ClickYes stuff.
    bPreview = False
    If bPreview Then
        DoCmd.SendObject acSendNoObject, , , "max.wanadoo at gmail.com", , ,
"Subject", "Text Body", bPreview
    Else
        Call fStartClickYes(True)
        DoCmd.SendObject acSendNoObject, , , "max.wanadoo at gmail.com", , ,
"Subject", "Text Body", bPreview
        Call fStartClickYes(False)
    End If
End Function
Public Function fStartClickYes(bStart As Boolean)
'Here is some vba code that starts and stops clickyes in the systray
' download from here and install.  The A2k7 version is not free.
'http://www.contextmagic.com/express-clickyes/
    Dim wnd As Long, uClickYes As Long, Res As Long
    ' Register a message to send
    uClickYes = RegisterWindowMessage("CLICKYES_SUSPEND_RESUME")
    ' Find ClickYes Window by classname
    wnd = FindWindow("EXCLICKYES_WND", 0&)
    If bStart Then
        ' Send the message to Resume ClickYes
        Res = SendMessage(wnd, uClickYes, 1, 0)
    Else
        ' Send the message to Suspend ClickYes
        Res = SendMessage(wnd, uClickYes, 0, 0)
    End If
End Function



More information about the AccessD mailing list