Word AddIn not starting after opening a document
-
miércoles, 07 de marzo de 2012 9:37
Hi all !
I've created a Word addin and it's working as I expect when I open Word directly.
The problem show up when I open a document : my addin is not starting. I can start it from the COM AddIn menu without problem after that, but it is really boring to do that everytime...
Thank you in advance for your answers !
Phil
Todas las respuestas
-
miércoles, 07 de marzo de 2012 10:33just to be sure: when you open word from shrotcut or any other such means - your add-in is up and running, but when you open word by clicking document - it is not - am i correct?
-
miércoles, 07 de marzo de 2012 12:20
To be more precise, if I open Word and no other word window (that was started from clicking on a document) is opened, then my AddIn starts.
If a Word window that was opened from clicking on a document is openend and that I start a new one, my addin won't start...
After that if I close all Word windows and start Word again from shortcut, my addin won't start until I start it from the COM AddIn dialog box again.
-
miércoles, 07 de marzo de 2012 12:26It seems like it gets disabled after some exception. Can you show us your Startup event of addin?
-
miércoles, 07 de marzo de 2012 12:42
TextPicker textPicker1; private void ThisAddIn_Startup(object sender, System.EventArgs e) { //Create and show the custom pane textPicker1 = new TextPicker(); ctpText = this.CustomTaskPanes.Add(textPicker1, "Insertion juridique", this.Application.ActiveWindow); ctpText.Visible = true; }I really don't see what would cause an exception to raise... my textPicker has never caused an error when I've debuged the AddIn
-
miércoles, 07 de marzo de 2012 13:11
Add try/catch around this code and log or show message box if error occurs. deploy and try new code.
- Marcado como respuesta Phil Lep miércoles, 07 de marzo de 2012 15:57
-
miércoles, 07 de marzo de 2012 13:34
Thank you for your help: you were right and I found the bug!
I don't know how to solve it yet: I want my cutom task pane to show when the AddIn loads, so I used this.Application.ActiveWindow. But it seems that when I start Word by clicking on a document the AddIn loads before the document opens... so there is no ActiveWindow and my AddIn crash.
Is there an event that raise when a document loads?
-
miércoles, 07 de marzo de 2012 13:44
maybe try DocumentOpen or WindowActivate- Marcado como respuesta Phil Lep miércoles, 07 de marzo de 2012 15:56
-
miércoles, 07 de marzo de 2012 15:55
I solved my problem by using the Application.WindowActivate event.
With the DocumentOpen event I had the same problem...
Thank you very much for your help!
Phil

