plugin para word visual basic

23/03/2006 - 15:54 por joelbernabe | Informe spam
Holas necesito crear un plugin para word desde visual basic, he seguido
las ayudas MSDN pero en word el plugin no me funciona, si logro ver el
plugin en word pero este se reinicia y se vuelve a insertar un nuevo
plugin cada vez que vuelvo a abrir el word, es decir, se va
multiplicando este plugin lo cual no es la idea, he leido que al
parecer es necesario crear una plantilla .dot para no tener este
problema pero no he encontrado la solucion, por favor si alguien puede
ayudarme gracias.
 

Leer las respuestas

#1 joelbernabe
23/03/2006 - 16:01 | Informe spam
He intentado con este codigo pero no puedo solucionar el problema por
favor ayudenme¡¡¡¡¡
http://support.microsoft.com/defaul...?kbid#8228


Option Explicit

Dim oXL As Object
Dim WithEvents MyButton As Office.CommandBarButton

Private Sub AddinInstance_OnConnection(ByVal Application As Object,
_
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)
On Error Resume Next
MsgBox "My Addin started in " & Application.Name

Set oXL = Application

Set MyButton = oXL.CommandBars("Standard").Controls.Add(1)
With MyButton
.Caption = "My Custom Button"
.Style = msoButtonCaption

' The following items are optional, but recommended.
' The Tag property lets you quickly find the control
' and helps MSO keep track of it when there is more than
' one application window visible. The property is required
' by some Office applications and should be provided.

.Tag = "My Custom Button"

' The OnAction property is optional but recommended.
' It should be set to the ProgID of the add-in, such that if
' the add-in is not loaded when a user presses the button,
' MSO loads the add-in automatically and then raises
' the Click event for the add-in to handle.

.OnAction = "!<" & AddInInst.ProgId & ">"

.Visible = True
End With

End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As _
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
On Error Resume Next
MsgBox "My Addin was disconnected by " & _
IIf(RemoveMode = ext_dm_HostShutdown, _
"Excel shutdown.", "end user.")

MyButton.Delete
Set MyButton = Nothing
Set oXL = Nothing
End Sub

Private Sub MyButton_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)
MsgBox "Our CommandBar button was pressed!"
End Sub

Preguntas similares