![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi
I have been trying for days now to create a solution for this. The problem is i have found some code examples on the web, but none of them has worked so far. Maybe i'm missing a reference when trying them i don't know (altho i have tried most references ). I have tried myself and also used msdn trying examples, tho it seems to me they put out examples for everything in outlook but the basic function of the program like working with mail messages and interacting Oulook with other office products. Maybe i lack some basic understanding, however i tried to read everything i could come across for this. This is the scenario: I am using Visual Studio 2008 Office 2007 I am making an Outlook ribbon where the user on editing in a oulook message, pick a word document from a dropdown in the Outlook ribbon and then i want the word document to be inserted where the user has hers/his cursor before going to the dropdown menu. I have made the same function for word: there i used this code and it works just as i want to Word.Range currentRange = Globals.ThisAddIn.Application.Selection.Range; object missing = System.Type.Missing; currentRange.InsertFile(workindirectory + "\\" + fname, ref missing, ref missing, ref missing, ref missing); However this does not work for Oulook. On my search i have encountered alot of people trying to find out the same thing. Seems to me alot of folks want to use word documents for some kind of standard template they can put into their email messages when replying to customers etc. However most examples i have found use fully automated answers. With office Ribbon that is not what you would normally want. The ribbon is there for a person to click ![]() new mail. You would want the word document to be inserted into the mail the user is working on. The closest i have come in my search are the Inspector.WordEditor; in the documentation it says this should put a word document at the users cursor. I have yet to find a C# example of this that actually works. And the documentation i have found for WordEditor is...well not very friendly ![]() Anyone that can help me here. Like i said i tried for days with 10-12 each day searching for it and im getting a bit frustrated. Thanks -- Huginson |
Ads |
#2
|
|||
|
|||
![]()
In Outlook 2007 there is only the Word editor and Inspector.WordEditor is a
Word Document object. It's a weak object reference for the Inspector that you get in the Inspectors.NewInspector() event, so you are best off instantiating an Inspector object in that event handler and subscribing to the Inspector.Activate() event for the Inspector. In the first Activate() event you can get WordEditor and cast it to a Word.Document object. Pretty simple really. There are C# examples for at least getting to WordEditor lots of places, for example at www.outlookcode.com. I have VS 2005 templates, including C#, that show how to handle up to the Inspector.Activate() event, from there all you need it this before you descend into the Word object model: Word.Document doc = (Word.Document)insp.WordEditor; -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Huginson" wrote in message ... Hi I have been trying for days now to create a solution for this. The problem is i have found some code examples on the web, but none of them has worked so far. Maybe i'm missing a reference when trying them i don't know (altho i have tried most references ). I have tried myself and also used msdn trying examples, tho it seems to me they put out examples for everything in outlook but the basic function of the program like working with mail messages and interacting Oulook with other office products. Maybe i lack some basic understanding, however i tried to read everything i could come across for this. This is the scenario: I am using Visual Studio 2008 Office 2007 I am making an Outlook ribbon where the user on editing in a oulook message, pick a word document from a dropdown in the Outlook ribbon and then i want the word document to be inserted where the user has hers/his cursor before going to the dropdown menu. I have made the same function for word: there i used this code and it works just as i want to Word.Range currentRange = Globals.ThisAddIn.Application.Selection.Range; object missing = System.Type.Missing; currentRange.InsertFile(workindirectory + "\\" + fname, ref missing, ref missing, ref missing, ref missing); However this does not work for Oulook. On my search i have encountered alot of people trying to find out the same thing. Seems to me alot of folks want to use word documents for some kind of standard template they can put into their email messages when replying to customers etc. However most examples i have found use fully automated answers. With office Ribbon that is not what you would normally want. The ribbon is there for a person to click ![]() a new mail. You would want the word document to be inserted into the mail the user is working on. The closest i have come in my search are the Inspector.WordEditor; in the documentation it says this should put a word document at the users cursor. I have yet to find a C# example of this that actually works. And the documentation i have found for WordEditor is...well not very friendly ![]() Anyone that can help me here. Like i said i tried for days with 10-12 each day searching for it and im getting a bit frustrated. Thanks -- Huginson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Retrieve document variable from attached Word document | Gordon Filby | Outlook and VBA | 1 | September 29th 08 12:30 PM |
Inserting a link to a Lotus Notes document | Maria Nocera[_2_] | Outlook - General Queries | 3 | June 10th 08 06:50 PM |
Outlook 2003 save active message as Word Document | Maxx[_2_] | Outlook and VBA | 1 | April 15th 08 02:29 PM |
How do I send a shortcut to a word document in an e-mail message? | Rich Romeo | Outlook - Using Contacts | 1 | July 9th 07 04:34 PM |
Inserting Contact Information into a Word document | HALinNY | Outlook - Using Contacts | 1 | March 28th 07 03:18 AM |