By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,649 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,649 IT Pros & Developers. It's quick & easy.

Automatically Sending E-mail

P: 6
Hi all-

I created a macro that sends out an email. I am now running into the issue of a security box poping up in which I have to click yes to allow the email to send. It reads:

"A program is trying to automatically send an e-mail on your behalf. Do you want to allow this?"

Is there a way to have the e-mail send without me clicking Yes? I did read another thread regarding this issue, however I did not understand how to implement the code to disable this pop-up warning.

The code snipet was: .DisableOOMWarnings = True

Is this the correct code to use? If so, could someone please elaborate on this to let me know how to implement it? Thanks for your time.
Jan 17 '07 #1
Share this Question
Share on Google+
4 Replies

P: 6
Can anyone help me here?
Jan 18 '07 #2

P: 37
post your code.
Jan 18 '07 #3

P: 6
Sorry it took so long to respond, it's been very busy around here lately. Any help is greatly apprieciated. Thanks in advance!

Here is my code:

Workbooks.Open Filename:= _
"C:\Documents and Settings\ABC\Desktop\ABC_Hourly.xls"
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\ABC\Desktop\Source Code Report.txt", _
.Name = "Source Code Report"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Application.CutCopyMode = False

Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set rng = Nothing
On Error Resume Next
Set rng = Selection.SpecialCells(xlCellTypeVisible)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If

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

On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "Hourly Report"
.HTMLBody = RangetoHTML(rng)
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing

End Sub
Feb 6 '07 #4

P: 6
Does anyone happen to know how to do this? Or does someone know of a resource I could go to for this issue?
Feb 12 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.