Help for Send Mail via Outlook

N

new.microsoft.com

I use a VBA code as following to send email in Excel, but every time the
Outlook require me to confirm Yes/No to send out mail. How can I disable
that confirmation step?

Thanks


Sub SendWithAtt()

Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim CurrFile As String


Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)


ActiveWorkbook.Save

' CurrFile = ActiveWorkbook.path & "\" & ActiveWorkbook.Name
CurrFile = ActiveWorkbook.path & "\" & "OSAllowRates.pdf"
With olMail
.To = ""
'.CC = ""
.Subject = "Testing"
.Body = "Hello"
.Body = ActiveSheet.Range("D4").Text & vbCrLf
.Attachments.Add CurrFile
.Send '.Display '
'.BodyFormat
End With

Set olMail = Nothing
Set olApp = Nothing

End Sub
 
R

Richard Buttrey

I use a VBA code as following to send email in Excel, but every time the
Outlook require me to confirm Yes/No to send out mail. How can I disable
that confirmation step?

Thanks

I had the same - frustrating problem, and the discovered the small
"ClickYes" bit of software - see

http://www.contextmagic.com/express-clickyes/

You still get the delay of 5 seconds whilst Outlook waits for an
answer, but then this utility 'presses' the OK key for you.

Rgds

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
 
N

new.microsoft.com

How can I use the outlook express to send mail rather than use outlook?
 
D

David McRitchie

Should be the same, after all a web page doesn't know
what email program you have for your default.

The other question about sending automatically is

ActiveWorkbook.FollowHyperlink (Olmail)
Application.Wait (Now + TimeValue("0:00:03"))
Application.SendKeys "%s"

--
 
D

David McRitchie

sorry hadn't looked carefully enough not familiar with Outlook
mail and thought you had created a string as it were a hyperlink
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top