Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to initiate a message in Outlook? 1

Status
Not open for further replies.

franzdom

Mechanical
Oct 24, 2006
4
0
0
US
I am fairly new to writing macros in Excel but am having good success, not just recording but also editing and managing them. I am hoping to include in one of my macros the function of starting a new outgoing message in Outlook (2003), pasting ctrl-v, then populating the To: field and finally sending the message.

If anyone has experience working with Office macros other than Excel I would really appreciate this.

Outlook does not have a record macros feature though it can handle macros that are written from scratch.

Thank you in advance!
 
Replies continue below

Recommended for you

Code:
Public Sub CreateMail()
  Dim olApp As Object
  Dim objNewMail As Object
  Dim MyDataObj As New DataObject 'set reference to microsoft forms 2.0 object lib
  Set olApp = CreateObject("Outlook.Application")
  Set objNewMail = olApp.CreateItem(0)
  MyDataObj.GetFromClipboard
  
  'objNewMail.Subject = "Mail Subject"
  'objNewMail.To = "Receipient@xxx.com"
  'objNewMail.Body = MyDataObj.GetText() 'This will paste clipboard comments into body
  objNewMail.display
End Sub
 
Status
Not open for further replies.
Back
Top