Dear Ralph,
her is my code for the Add-In:
Imports Microsoft.Office.Core
Imports Extensibility
imports System.Runtime.InteropServices
Public Class Connect
Implements Extensibility.IDTExtensibility2
Dim applicationObject as Object
Dim addInInstance As Object
Dim wordApp As ApplicationId
Dim WithEvents objBTT As CommandBarButton
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
Symbolleiste(applicationObject, True)
End Sub
Sub Symbolleiste(ByVal objApp As Object, ByVal boolStatus As Boolean)
Dim objCB As CommandBar
If boolStatus = True Then
'Symbolleiste erstellen
objCB = objApp.CommandBars.Add("Wetter", , , True)
objBTT = objCB.Controls.Add(1)
objBTT.Style = 2
objBTT.Caption = "Action"
objCB.Visible = True
' objBTT = objCB.Controls.Add(1, 2)
' objBTT.Style = 2
' objBTT.Caption = "Start"
' objCB.Visible = True
Else
'Symbolleiste löschen
objBTT.Parent.Delete()
End If
End Sub
Sub Ausgabe(ByVal strText As String, ByVal objApp As Object)
objApp.Selection.Range.Text = strText
End Sub
Sub Linie_ziehen(ByVal objApp As Object)
objApp.Selection.Shapes.AddLine(BeginX:=80, BeginY:=80, EndX:=80, EndY:=130).Select()
objApp.ShapeRange.Line.Weight = 3.0#
objApp.Selection.ShapeRange.Line.Visible = msoTrue
objApp.Selection.ShapeRange.Line.Style = msoLineSingle
End Sub
Private Sub objBTT_Click(ByVal Ctrl As CommandBarButton, ByRef CancelDefault As Boolean) Handles objBTT.Click
If objBTT.Application.name = "Microsoft Word" Then
Ausgabe("TEST", objBTT.Application)
Linie_ziehen(objBTT.Application)
End If
End Sub
End Class
The Sub "Ausgabe" is writing the word "TEST" on the active word doc, but "Linie_ziehen" causes an
System.MissingMemberException error.
Post by RalphPost by Thomas LinealDear Communitiy,
i'm very new to this newsgroup and to Visual Basic.
I want to make a COM Add-In for Word and PowerPoint. This Add-In should
contain painting routines with AddLine and AddShape commands. The Painting
should be accessed by a Toolbar.
The compiles without any problems and i can install it with the setup
routines.
If i start Word, the Add-In is loaded and the Toolbar is created. But
pressing the button for the painting routine, nothing will happen.
The same worked very fine, if i use it as a macro but as a COM Add-In it
just does nothing.
Thanks in advance
Thomas
Hard to say.
You might check out this article and see what might be missing from your
component.
http://support.microsoft.com/kb/238228