As there was no response about using an external .msg file in order to send information from within Excel, I will have to manage with the attached.
I do, however, need help to verify that the contents of the cell is an Email Addy.
Currently I can only test to see if it's blank.
If anyone has better suggestions about using a .msg file OR how to check that the contents are in email@address.com format, PLEASE send me a note.
Scott
mailto:sellen@aol.com
~~~~~~~~~~~~~~~~~~
Sub Email_standard_Product_info()
'
' Email_standard_Product_info Macro
' This macro will read the current cell (which should contain an email@address.info type of contents) and then send a message and standard product literature to that addy.
'
' Keyboard Shortcut: Ctrl+m
'
' Macro recorded 01-11-2011 By Scott Ellenwood
'
'Dimension the Variables as Strings or Objects
Dim OutApp As Object
Dim OutMail As Object
Dim ToAddy As String
Dim Signature As String
Dim Bodytext As String
'Copy the contents of the current cell as the TO address. Needs to be in name@whatever.com format
ToAddy = ActiveCell.Value
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
'Designate the text etc that will comprise the body of the message or signature.
' How to bold it??
Bodytext = "Dear Sir or Madam -" & vbCrLf & vbCrLf & _
"Attached, Please Blah Blah Blah"& vbCrLf & _
"Regards,"
'Now Designating the contents of the Signature using the following text.
Signature = "Wonderful Little Me" & vbCrLf & _
"Outside Sales And Development"
'Test to make certain the Email TO value is not blank
If ActiveCell.Value = "" Then
GoTo ErrorTrap1
Else
End If
On Error Resume Next
With OutMail
.To = ToAddy
.CC = ""
.BCC = ""
.Subject = "Product Information Enclosed"
.Body = Bodytext & vbCrLf & Signature
.Attachments.Add "C:\other_stuff.pdf"
.Send
.Close SaveChanges:=False
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = False
End With
MsgBox "Email Sent to [ " & ToAddy & " ]. Have a nice day."
GoTo EndofMacro
ErrorTrap1:
MsgBox "Sorry, Charlie. Blank Cells Ain't gonna work."
EndofMacro:
End Sub
Function GetBoiler(ByVal sFile As String) As String
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
Bookmarks