+ Reply to Thread
Results 1 to 2 of 2

MS Excel VBA - issue: sending automatic e-mail (pop-up to press "Allow" before sending)

  1. #1
    Registered User
    Join Date
    01-08-2016
    Location
    Belgium, Zonhoven
    MS-Off Ver
    MS Office 2016
    Posts
    0

    Talking MS Excel VBA - issue: sending automatic e-mail (pop-up to press "Allow" before sending)

    Hi all,

    I have written the code below so that if a value in a specific cell is greater than value 25 when workbook is closed, I automatically receive an e-mail with body "Content is changed". Code is working perfectly, however a pop-up appears with a loading bar. As soon as this bar is loaded, you need to click on "Allow" to send this mail, if someone press on "Deny", the mail will not be send out.

    Therefore I am searching for a solution to avoid this pop-up or include the following (wait until loading bar is loaded + click "Allow") is integrated in the code.

    I have used the function "Help", they suggest to adjust the Outlook options in MS Outlook -> Trust Center -> Trust Center settings -> Programmatic Access. However as this code is working from a Microsoft Exchange Server, I am not able to change this option.

    Code:

    This Workbook:

    Private Sub Workbook_Open()
    Call Macro_Test
    End Sub

    Private Sub Workbook_Deactivate()
    Call Macro_Run
    End Sub



    Module1:

    Public inhoud1 As String
    Public inhoud2 As String

    Sub Macro_Test()
    inhoud1 = Range("C13")
    End Sub

    Sub Macro_Run()
    inhoud2 = Range("C13")
    If Not inhoud2 = inhoud1 Then
    If inhoud2 > 25 Then
    'Start Mailing
    Dim OutApp As Object
    Dim OutMail As Object

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
    .To = "e-mail adress"
    .CC = ""
    .BCC = ""
    .Subject = "Subject"
    .Body = "Content is changed"
    .Attachments.Add Order.FullName
    .Send 'or use .Display
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

    'Range("A1").Value = "Mail is gestuurd"

    'End mailing

    Else: Exit Sub
    End If
    End If
    End Sub


    I would like to thank you in advance to help me in achieving constructing this code.


    Kind regards,

    Jeffrey

  2. #2
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,164
    Hello The_fixer,

    Welcome to Excelforum. Be a part of large Excel community. Enjoy Learning.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sending the automatic mail
    By G.Bregvadze in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-14-2013, 03:24 PM
  2. automatic sending mail from excel 30 days before due date
    By tekken in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-14-2013, 09:12 AM
  3. Excel 2007 : Automatic e-mail sending in Excel 2007
    By Guvanch in forum Excel General
    Replies: 1
    Last Post: 03-31-2012, 02:46 PM
  4. issue with sending mail thru xls
    By associates in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2007, 10:30 PM
  5. [SOLVED] automatic e-mail sending from excel
    By Ivica Rihter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2006, 04:55 PM
  6. Sending automatic e-mail from Xl
    By JBCIB in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-25-2006, 03:57 PM
  7. Sending macro based e-mail with built-in "Heading" and "Text"
    By Prabha in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2005, 11:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1