Email from vba

  • Thread starter Thread starter ADK
  • Start date Start date
A

ADK

What if a user does not have Outlook?

If a user has Outlook Express, would it work?

I want to place the auto emailing code in with my error sub so I get an
email when a user getsan error in the office.

Clip from code:

Sub Mail_small_Text_Outlook()
' Is working in Office 2000-2007
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
--------------------------------------------------------------
 
here's a snippet of what i use for my clients with oe:

Sub test()
fpath = ThisWorkbook.Path & "\"
msg = fpath & "Inventory_Low.xls"
Recipient = "(e-mail address removed)"
Recipientcc = ""
Recipientbcc = ""

Subj = "Inventory Alert."
HLink = "mailto:" & Recipient & "?" & "cc=" & Recipientcc & "&" &
"bcc=" & Recipientbcc & "&"
HLink = HLink & "subject=" & Subj & "&"
HLink = HLink & "body=" & msg
ActiveWorkbook.FollowHyperlink (HLink)
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys "%s"
End Sub
 

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

Back
Top