Bonjour à tous,
J'ai un petit souci avec un objet _appword de la class Word.Application.
En effet cet objet retourne une exception :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
_appWord = new Word.Application();           if (this._appWord.ActiveDocument.Path == string.Empty)
            {
                string str = "";
                MessageBox.Show("Nouveau document");
                try
                {
                    int nbvar = this._appWord.ActiveDocument.Variables.Count;
 
                    for (int i = 1; i <= nbvar; i++)
                    {
                        object item = i;
                        str += "Name : " + this._appWord.ActiveDocument.Variables.get_Item(ref item).Name +
                                " Value : " + this._appWord.ActiveDocument.Variables.get_Item(ref item).Value + Environment.NewLine;
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }
L'exception est la suivante :
this._appWord.ActiveDocument = 'this._appWord.ActiveDocument' a levé une exception de type 'System.Runtime.InteropServices.COMException'
Pourtant au moment d'instancier l'objet _appWord il lance bien un process WINWORD...