[dba-VB] C# Outlook Automation

Dan Waters df.waters at comcast.net
Wed May 11 10:46:41 CDT 2011


Hi John,

This is a VBA module to automatically push the ClickYes button - I have not
used this.  Might have some useful content.  Came from:
http://www.contextmagic.com/express-clickyes/

'----------------------------
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 blnPreview 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.
    
    blnPreview = False
    
    If blnPreview Then
        DoCmd.SendObject acSendNoObject, , , "max.wanadoo at gmail.com", , ,
"Subject", "Text Body", blnPreview
    Else
        Call fStartClickYes(True)
        DoCmd.SendObject acSendNoObject, , , "max.wanadoo at gmail.com", , ,
"Subject", "Text Body", blnPreview
        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 lngWnd As Long
    Dim lngClickYes As Long
    Dim lngResume As Long
    
    '-- Register a message to send
    lngClickYes = RegisterWindowMessage("CLICKYES_SUSPEND_RESUME")
    
    '-- Find ClickYes Window by classname
    lngWnd = FindWindow("EXCLICKYES_WND", 0&)
    
    If bStart Then
        '-- Send the message to Resume ClickYes
        lngResume = SendMessage(lngWnd, lngClickYes, 1, 0)
    Else
        ' Send the message to Suspend ClickYes
        lngResume = SendMessage(lngWnd, lngClickYes, 0, 0)
    End If
    
End Function

'----------------------------

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Wednesday, May 11, 2011 9:58 AM
To: VBA
Subject: [dba-VB] C# Outlook Automation

Has anyone found C# code to emulate the ClickYes program?  I found something
in VB5/6 for building a program that sits in the toolbar but it seems that
if you can do that, then you could just as easily look for the pop-up right
in your own code and click the yes button.

Just thought I'd check here before re-inventing the wheel.

--
John W. Colby
www.ColbyConsulting.com
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com






More information about the dba-VB mailing list