I have to create a small addin which works on Powerpoint, Word, Outlook, and Excel on Office 2000, XP, and 2003.
This addin consists in adding 2 new Buttons in the "File" Menu of office. This is properly done, but the events which should be triggered with the button.click method are not triggered in Word.
I don't understand because it properly works in the 3 others host applications.
If someone has an issue, I would be most grateful.
Thanks
here is the code of my connect.vb file:
_______________ _______________ _______________ _______
Imports Microsoft.Offic e.Core
' importe les objets nénécessaires Ã* la construction des menus ou autres outils
' au sein de microsoft office
Imports Extensibility
' importe l'interface IDTExtensibilit y2, et les objets nécessaires Ã*
' la "connection " de l'addin Ã* l'application hôte
Imports System.Runtime. InteropServices
#Region " Lisez Moi pour avoir des infos sur l'installation de l'addin sur d'autres postes. "
' Dans la fenetre Solution Explorer de Visual Studio .NET 2003, il faut:
' * click droit sur <nomDuProjet> ; et choisir "build" .
' * click droit sur <nomDuProjet>Se tup ; et choisir "build" .
' * Sur l'autre poste :
' ** copier le répertoire du projet en cours.
' ** executer (dans ce répertoire) /MyCOMAddinSetup/debug/setup .
' ** ouvrir une des applications hôte.
#End Region
' classe connect: classe qui lance l'execution de l'addin a chaque lancement
' de l'application hôte. Cette classe implémente l'interface IDTExtensibilit y2
<GuidAttribute( "8EFC12FE-8F9C-4802-88B0-56F297E844E0"), ProgIdAttribute ("MyCOMAddin.Co nnect")> _
Public Class Connect
Implements IDTExtensibilit y2
Dim applicationObje ct As Object
Dim addInInstance As Object
Dim WithEvents workitSave As CommandBarButto n
Dim WithEvents workitSaveAs As CommandBarButto n
Public Sub OnBeginShutdown (ByRef custom As System.Array) Implements Extensibility.I DTExtensibility 2.OnBeginShutdo wn
On Error Resume Next
' Notify the user you are shutting down, and delete the button.
MsgBox("Our custom Add-in is unloading.")
workitSave = applicationObje ct.CommandBars. FindControl(Tag :="workit save")
workitSave.Dele te()
applicationObje ct.NormalTempla te.Save()
workitSave = Nothing
workitSaveAs = applicationObje ct.CommandBars. FindControl(Tag :="workit save as")
workitSaveAs.De lete()
applicationObje ct.NormalTempla te.Save()
workitSaveAs = Nothing
End Sub
Public Sub OnAddInsUpdate( ByRef custom As System.Array) Implements Extensibility.I DTExtensibility 2.OnAddInsUpdat e
'
End Sub
Public Sub OnStartupComple te(ByRef custom As System.Array) Implements Extensibility.I DTExtensibility 2.OnStartupComp lete
Dim oCommandBars As CommandBars
On Error Resume Next
oCommandBars = applicationObje ct.CommandBars
If oCommandBars Is Nothing Then
' Outlook has the CommandBars collection on the Explorer object.
oCommandBars = applicationObje ct.ActiveExplor er.CommandBars
End If
workitSave = oCommandBars("F ile").Controls. Item("workit save")
If workitSave Is Nothing Then
workitSave = oCommandBars("F ile").Controls. Add(Type:=MsoCo ntrolType.msoCo ntrolButton, Id:=1)
workitSave.Capt ion = "workit save"
workitSave.Tool tipText = "workit save"
workitSave.Tag = "workit save"
workitSave.Styl e = MsoButtonStyle. msoButtonCaptio n
workitSave.OnAc tion = "!<MyCOMAddin.C onnect>"
End If
workitSaveAs = oCommandBars("F ile").Controls. Item("workit save as")
If workitSaveAs Is Nothing Then
workitSaveAs = oCommandBars("F ile").Controls. Add(Type:=MsoCo ntrolType.msoCo ntrolButton, Id:=1)
workitSaveAs.Ca ption = "workit save as"
workitSaveAs.To oltipText = "workit save as"
workitSaveAs.Ta g = "workit save as"
workitSaveAs.St yle = MsoButtonStyle. msoButtonCaptio n
workitSaveAs.On Action = "!<MyCOMAddin.C onnect>"
End If
' Display a simple message to show which application you started in.
MsgBox("Started in " & applicationObje ct.Name & ".")
oCommandBars = Nothing
End Sub
Public Sub OnDisconnection (ByVal RemoveMode As Extensibility.e xt_DisconnectMo de, ByRef custom As System.Array) Implements Extensibility.I DTExtensibility 2.OnDisconnecti on
On Error Resume Next
If RemoveMode <> Extensibility.e xt_DisconnectMo de.ext_dm_HostS hutdown Then _
Call OnBeginShutdown (custom)
applicationObje ct = Nothing
End Sub
Public Sub OnConnection(By Val application As Object, ByVal connectMode As Extensibility.e xt_ConnectMode, ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.I DTExtensibility 2.OnConnection
MsgBox("On Connection In MyAddin")
applicationObje ct = application
addInInstance = addInInst
' If you aren't in startup, manually call OnStartupComple te.
If (connectMode <> Extensibility.e xt_ConnectMode. ext_cm_Startup) Then _
Call OnStartupComple te(custom)
End Sub
Private Sub workitSave_Clic k(ByVal Ctrl As Microsoft.Offic e.Core.CommandB arButton, ByRef CancelDefault As Boolean) Handles workitSave.Clic k
MsgBox("vous voulez sauver ds workit")
End Sub
Private Sub workitSaveAs_Cl ick(ByVal Ctrl As Microsoft.Offic e.Core.CommandB arButton, ByRef CancelDefault As Boolean) Handles workitSaveAs.Cl ick
MsgBox("vous voulez sauver ds workit mais sous un autre nom")
End Sub
End Class
_______________ _______________ _______________ __________
it's a very simple code that make the same mistake on every configuration of PC I tried.
Thanks 0 3188 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: teb |
last post by:
Hello all,
Here is basically the situation. I have an empty div on my page.
When I mouseover a word, the innerHTML of the div gets written with a
table. The td elements all have onclick, onmouseover, etc. events.
When I mouseover a word, the div appears, but none of the events fire
until another event occurs. For example, if I put in an alert box or
I right click, and then mouseover the div, the td events then work.
Keep in mind that...
|
by: Mark |
last post by:
Hi,
I'm writing user controls with custom events.
I have a parent custom event that exposes some abstract methods and
some custom events.
I have also created some new user controls that derive from the parent
custom control and add some text boxes, labels, buttons etc...
|
by: lkr |
last post by:
hi
is there is anyway to capture the document events of a MSWord?eg:I have to
handle the event awhen WM_KEYUP or anyother events will occur.
give me a solution............
thanks in advance
lkr
|
by: Thiago Arrais |
last post by:
I am writing a VS .NET Addin and I need to create menu items
(CommandBarButtons) at run-time. I can do that but the event handlers
do not work. They are registered using AddHandler (wich was created
for that, isn't it?), but I think I am using it wrongly, because only
the last registered button fires the event and only if it the button
variable is declared as a class field (sorry if the term is incorrect,
I am new to VB and .NET).
Any...
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the application.
What should happen, is that the main MDI form should close, taking the child
forms with it. There is code to loop through the child forms, remove the
controls on each of them, and then close the form, but this code should
execute only...
| |
by: Galin iliev |
last post by:
Hello guys
I 've been digging for a while trying to add nice image to CommandBarButton
in MS Word using VS 2005 without aby luck.
I found http://blogs.msdn.com/vsto/archive/2003/12/18/44404.aspx and
http://support.microsoft.com/default.aspx?scid=kb;en;288771
second one gives very good exmaple for merging image and mask in Clipboard
and paste face on button at once. there is some code for creating mask image
from source but it is on VB6...
|
by: dbuchanan |
last post by:
Hello,
The actions pane locks up after selecting a listbox.
I have tried all kinds of things and have narrowed it down to this. If
I click in the listbox the action pane locks up. Neither a combo box
nor a button will work after clicking in the list box. There are no
events associated with the list box. This is a mystery to me.
What could be causing this behavior? What could be the remedy?
|
by: Joseph Geretz |
last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm
adding matching pairs of Toolbar buttons and Menu items. All of the buttons
and menu items are wired up to send events to the same method (aka
delegate?). I use the Tag property within this method to determine what user
action is taking place. Very simple:
When adding toolbar button:
tbButton.Click += new...
|
by: ppardi |
last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user
saves a Word 2007 document in an older format (97-2003) after a save as is
done. The scenario is that the user starts out with a Word 2007 document,
saves that document to disk, then saves the same document in an older format
If the user saves a doc in an older format, I want to turn off certain
features of my add-in. I'm able to trap the save event easily...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |