Results 1 to 5 of 5
  1. #1
    Dave_D's Avatar
    Dave_D is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    67

    SENDKEYS not working

    I'm using docmd.sendobject (a table) to OUTLOOK. Out network has generated the following message. See attachment. If unable to open attachment it reads as follows:

    A program is trying to send an e-mail message on your behalf. if this is unexpected, click Deny and verify your antivirus software is up-to-date.

    Below this line is a solid green bar with 3 boxes, ALLOW, DENY & HELP and DENY is the box high lited.

    I'm trying to use SENDKEYS so that the user doesn't have to perform this operation and by tabbing to ALLOW and then pressing ENTER to accept the warning.
    I've added:
    Outlk = Shell("c:\program file (x86)\MicroSoft office\Office16\OUTLOOK.exe", AppWinStyle.NormalFocus)
    AppActivate (Outlk)

    My sendkeys is
    SENDKEY "{+}" & "{TAB}"



    1. Can this be done using SENDKEYS?
    2. Am I using the correct code? Upon stepping thru the code, the code just greys out until I actually press ALLOW and DENY myself.

    Any help with this is appreciated!
    Attached Thumbnails Attached Thumbnails doc1.jpg  

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    That looks like a very old version of office?
    If you use outlook automation, generally that warning no longer exists.

    I vaguely seem to remember getting around that warning about 15 years ago, let me see if I can find some old code...
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Whilst you are waiting for Minty's method, start looking here?
    https://www.google.com/search?q=outl...hrome&ie=UTF-8
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Ive been programming in Office/Access for 20+ years and never needed to use SENDKEYS.

  5. #5
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    Agreed with ranman, do your really need to use sendkeys?

    Wouldn't something like this be cleaner?

    Code:
    Sub sendOutlookEmail()
        Dim oApp As Outlook.Application
        Dim oMail As MailItem
        
        Set oApp = CreateObject("Outlook.application")
        Set oMail = oApp.CreateItem(olMailItem)
        
        oMail.Body = "Body of the email"
        oMail.Subject = "Test Subject"
        oMail.To = "Someone@somewhere.com"
        
        oMail.Display 'show the email
        'oMail.Send    'or just send the email
        
        Set oMail = Nothing
        Set oApp = Nothing
    End Sub
    To get the outlook objects from your access project you'll need to go to your vba editor window, go to Tools menu -> References -> and then check Microsoft Outlook 16.0 Object Library (16.0 for me, maybe another version for you)

    https://stackoverflow.com/questions/...hrough-outlook

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Need to SendKeys {Insert} and {Up} at once
    By BrooksR in forum Programming
    Replies: 2
    Last Post: 01-25-2019, 02:37 PM
  2. Sendkeys and Utility Add-Ins
    By steve.redman in forum Access
    Replies: 12
    Last Post: 12-13-2013, 02:31 PM
  3. sendkeys, anyone have experience?
    By redbull in forum Programming
    Replies: 1
    Last Post: 02-14-2013, 10:44 AM
  4. Sendkeys replacement
    By numberguy in forum Programming
    Replies: 6
    Last Post: 07-14-2011, 08:29 AM
  5. Sendkeys replacement
    By numberguy in forum Forms
    Replies: 3
    Last Post: 10-29-2010, 07:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums