Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Outlook from Access (Access 2003)

    I have the following code that creates and should send an email from Outlook.
    What it IS doing is creating the email. It opens a window for each email, then creates a second, third..., but the SendKeys is not causing the email to be sent.


    With rsEmailsToSend
    'Do While Not .EOF
    For x = 1 To 3000
    Set olkMail = objOLK.CreateItem(olMailItem)
    olkMail.To = .Fields("TO")
    strSubject = .Fields("SUBJECT")
    olkMail.Subject = strSubject
    olkMail.Body = .Fields("EMAIL_MSG")
    If Not IsNull(.Fields("CC")) Then
    olkMail.CC = .Fields("CC")
    End If
    olkMail.SentOnBehalfOfName = "hrservicecenter@familydollar.com"
    olkMail.ReadReceiptRequested = False
    olkMail.Display
    ws.AppActivate strSubject
    SendKeys "%S", True
    'If Window_Sent(strSubject) Then
    For y = 1 To 5000000
    y = y + 1
    Next y
    .Fields("SENT") = -1
    .Fields("DATE_SENT_TS") = Now()
    .Update
    .MoveNext
    'End If
    Next x



    HELP.


    Thanks
    Richard

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Outlook from Access (Access 2003)

    Instead of

    olkMail.Display
    ws.AppActivate strSubject
    SendKeys "%S", True

    use

    olkMail.Send

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outlook from Access (Access 2003)

    That seems to be working, but now I get a dialog for each email warning me that a progam is trying to send email on my behalf.

    Is there a way to turn this warning off?
    Richard

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Outlook from Access (Access 2003)

    See <post#=488,173>post 488,173</post: >.

Posting Permissions

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