Bonjour. En m'inspirant de l'exmple de L. G. MORAND, j'ais écrit le code suivant dans mon module connect.vb
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Imports System
Imports Microsoft.Office.Core
imports Extensibility
Imports System.Runtime.InteropServices

#Region " Read me for Add-in installation and setup information. "
' When run, the Add-in wizard prepared the registry for the Add-in.
' At a later time, if the Add-in becomes unavailable for reasons such as:
'   1) You moved this project to a computer other than which is was originally created on.
'   2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
'   3) Registry corruption.
' you will need to re-register the Add-in by building the $SAFEOBJNAME$Setup project, 
' right click the project in the Solution Explorer, then choose install.
#End Region

<GuidAttribute("80A355F8-FBC5-4C56-84FA-B6BCADE7B79C"), ProgIdAttribute("MyAddin1.Connect")> _
Public Class Connect
	
	Implements Extensibility.IDTExtensibility2

	Dim applicationObject as Object
    Dim addInInstance As Object

    Dim Liaison As System.Reflection.Binder
    Dim args As Object()
    Dim app As Word._Application = DirectCast(applicationObject, Word._Application)

    Private Bouton As CommandBarButton
    Private BarOutils As CommandBars
    Private BarStandard As CommandBar

	Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnBeginShutdown
	End Sub
	
	Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnAddInsUpdate
	End Sub
	
	Public Sub OnStartupComplete(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnStartupComplete
	End Sub
	
	Public Sub OnDisconnection(ByVal RemoveMode As Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnDisconnection
	End Sub
	
	Public Sub OnConnection(ByVal application As Object, ByVal connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
        applicationObject = application
        addInInstance = addInInst

        BarOutils = DirectCast(applicationObject.GetType.InvokeMember("CommandBars", Reflection.BindingFlags.GetProperty, Nothing, applicationObject, Nothing), CommandBars)
        BarStandard = BarOutils("Standard")
	End Sub

End Class
Le problème est que le type "word._application" n'est pas reconnu. Alors je n'arrive pas à démarrer word depuis mon application. Au mieux c à d en supprimant la ligne en gras, je démarre une autre instance de visual studio. Comment corriger ce problème?