Consulting

Results 1 to 5 of 5

Thread: Auto Item Send Error

  1. #1
    VBAX Regular
    Joined
    Sep 2006
    Location
    Midwest
    Posts
    35
    Location

    Auto Item Send Error

    Awhile back, I set up a program to auto send email. A day or so ago the IT dept had to do some resetting. Now, instead of auto mailing one letter with attachment after another I'm getting a prompt asking me that the program is trying to automatically send email on my behalf and do I want to allow this?


    Any ideas on how to reset this @##*!!# rule??
    Thanks,
    Tom
    Tom
    Some say that the glass is half empty
    Some say that the glass is half full
    I say they delivered the wrong size
    glasses

  2. #2
    VBAX Regular
    Joined
    Sep 2006
    Location
    Midwest
    Posts
    35
    Location
    As a side note, I considered using a "SendMail" command line BUT it would require a larger rewrite (which I may have to do anyway)
    Tom
    Some say that the glass is half empty
    Some say that the glass is half full
    I say they delivered the wrong size
    glasses

  3. #3
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    I'm guessing you're using Outlook. What you're seeing is a standard security warning that occurs whenever automation tries to take over Outlook to create a new e-mail. The only way to get rid of it is to install a patch to Outlook... but most IT departments won't install it because of security risks- it completely turns off the warning, so a virus could send e-mails without warning.

    The following code uses the ShellExecute API to create a new e-mail message. Since it doesn't directly interface with Outlook you may be able to use it to create your e-mails without the warning appearing.

    [VBA]Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
    ByVal hWnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
    Private Const SW_SHOW As Long = 5
    Sub SendEmail(strTo As String, strSubject As String, strBody As String)
    Dim rc As Long
    Dim strFile As String
    'build the lpFile argument
    strFile = "Mailto:" & strTo
    strFile = strFile & "?subject=" & strSubject
    strFile = strFile & "&body=" & strBody
    rc = ShellExecute(0, "open", strFile, "", "", SW_SHOW)
    End Sub[/VBA]
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  4. #4
    VBAX Tutor Mavyak's Avatar
    Joined
    Jul 2008
    Posts
    204
    Location
    You can also download AutoIT and run the follwoing script concurrently with your existing script and it will click the necessary controls to allow access to Outlook for 10 minutes every ten minutes until you cancel it or fail to answer it for a certain period of time:

    $result = -1
    $x = 0
    While $result = -1
        If WinActive("Microsoft Office Outlook") Then    
            WinActivate("Microsoft Office Outlook");
            ControlClick("Microsoft Office Outlook", "", "[ID:4771]")
            Sleep(500)
            ControlCommand("Microsoft Office Outlook", "", "[ID:4773]", "SelectString", '10 Minutes')
            Sleep(1000)
            WinActivate("Microsoft Office Outlook")
            Send("{TAB}")
            Sleep(1000)
            Send("{TAB}")
            Sleep(1000)
            Send("{ENTER}")
            Sleep(500)
            $result = MsgBox(36, "Success!", "Success", 10);
            If $result = -1 Then
                Sleep(570000)
            EndIf
        Else
            If $x < 101 Then
                Sleep(5000)
                $x = $x + 1
            Else
                $result = MsgBox(36, "Awaiting Security Popup", "Continue waiting?", 10)
                If $result = 6 Then
                    $result = -1
                    $x = 0
                EndIf
            EndIf
        EndIf
    WEnd

  5. #5
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    There's also an article on the freeware ClickYes utility that does the same thing, just without you C&Ping the script code required for Auto IT.

    If the API ShellExecute method works for you, then that would be a slightly better alternative because it will use fewer resources than having a concurrently running utility app to deal with the message.

    Food for thought.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •