View Single Post
  #2  
Old June 1st 10, 01:55 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_4_]
external usenet poster
 
Posts: 552
Default Programatically click the Send button.

You already have the message as the mail object, so just call mail.Send
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54

"Marketware" wrote:

I have a program that pastes the contents of a word document into an email
message. (See Below)

Now what I need to do is programatically click the Send button.

I realize there are easier ways to send an email, but I need to be able to
cut and paste exactily what is in the word document.

The question is, how to use either the inspector object or whatever to click
that send button.

mail = (Outlook.MailItem)oMailFolder.Items.Add(Outlook.Ol ItemType.olMailItem);

object start = WordApp.MergeDoc.Content.Start;
object end = WordApp.MergeDoc.Content.End;
Word.Range range = WordApp.MergeDoc.Range(ref start, ref end);

range.Copy(); //Put Contents into clipboard

inspector = mail.GetInspector;
if (inspector.EditorType == OlEditorType.olEditorWord)
{
Word.Document WordEditor = (Word.Document)inspector.WordEditor;
start = WordEditor.Content.Start;
end = WordEditor.Content.End;

Word.Range range2 = WordEditor.Range(ref start, ref end);

range2.Paste();

}

//Click Send Button

Thanks!!

bob




Ads