×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro to initiate a message in Outlook?

Macro to initiate a message in Outlook?

Macro to initiate a message in Outlook?

(OP)
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!

RE: Macro to initiate a message in Outlook?

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources