Excel VSTO Addin not handling commandbarbutton.click event - c#-3.0

I am developing an Excel VSTO C# add-in. The add-in has a single command-bar ribbon with 1 command-bar-button.
the purpose of this button is to
open a dialog window that allows search dates to be entered
then calls off to a web-service to retrieve data, which gets populated in the spreadsheet.
The problem is that after the install of the add-in it all works as expected. however after shutting down excel, then reopening it later, the click event on the command-bar-button is no longer handled or is not firing.
The VSTO addin is installed from a network location.

If your add-in targets Excel 2007, and doesn't require to be installed on Excel 2003, there is no reason to use CommandBar buttons - use the Ribbon. It will make your development easier, and will look better, too. If you already use Excel 2007 to open and work with the Excel 2003 document and this hasn't caused problems, doing the same via VSTO should not introduce problems.
There are plenty of tutorials on how to use the Ribbon; I have one post on my blog showing how to add a button to the Ribbon to trigger some action: http://www.clear-lines.com/blog/post/create-excel-2007-vsto-add-in-ribbon.aspx

Related

How to Add Custom Option in MS Word File Menu by Office Addin using manifest.xml

How can we add a custom option in "File Menu/Tab" by custom "Office Addin"?
I can find how to add "Control" in an office tab using "ExtensionPoint". But I am unable to find how can we add a custom option in "File Menu". Following are the documentation links I have gone through.
https://learn.microsoft.com/en-us/office/dev/add-ins/reference/manifest/extensionpoint
https://learn.microsoft.com/en-us/office/dev/add-ins/reference/manifest/officetab
image 1:
image 2:
The Backstage UI can't be customized with web add-ins. See Add-in commands for Excel, PowerPoint, and Word for more information about possible customizations.
Feature requests on Tech Community are considered, when the dev team go through the planning process. Use the github label: “Type: product feature request” at https://aka.ms/M365dev-suggestions .
FYI these customizations are possible using COM add-ins, so you may also consider creating a VSTO based add-in instead, see Walkthrough: Create your first VSTO Add-in for Outlook.

Dynamic data manipulation in word online

I am trying to build a task-pane add-in for word online which can do mail merge like desktop office. Now I understand that word online does not support mail merge out of the box, so I thought about the following steps -
Create a template (DOTX) using desktop office which will contain Region or something like a merge field etc. Upload the template to one drive.
Open a blank doc and add a task pane add-in in word online. This is temporary step for now.
Click a button on the add-in.
This click will stream the template (DOTX) from server using an app service call.
Render the stream into word online web page.
Edit and save.
Close word online and reopen.
Click the doc link.
This will render the doc in word online.
Add the add-in in the task pane (temp step).
Click edit button.
Call app service to fetch the latest merge data source.
Traverse through the word xml and replace the values corresponding to the region or special keys.
Re-render the doc.
My users will have E1 subscription of office 365.
Is this thought process logical and achievable with word online? Thanks in advance!...
I think your approach is much more complicated than it needs to be. Word Online supports Add-ins created using the JavaScript APIs, as supported by the information in this article: https://msdn.microsoft.com/EN-US/library/office/dn833104.aspx
It should be possible for you to create the "template" on the Desktop (Word 2013 or 2016 is required - but only 2016 supports the current full scope of the JS API) and "insert" your add-in, which links it to the document. Opening the document in Word online should automatically load the add-in, that can then link to the data source and fill in the data.
As data targets ("merge fields"), I recommend you use Content Controls.

Automatically loading Word Task Pane Office Add-in

We are developing a Word Task Pane Office Add-in (not VSTO) for internal organization documents
In Word 2013 (desktop) when we insert the add-in and save the document, when we reopen that document the add-in is automatically loaded.
In Word Online, this behavior is different, the add-in doesn't get automatically loaded. The user has to manually insert the add-in every time the document is opened.
Is there a way to automatically load it in Word Online?
Would running our own Office Web App Server help?
Is there a way to load the add-in through a parameter? (maybe query string?)
Thanks
We have changed the behaviour you describe: starting in January, Word Online add-ins will be persisted in the document just like they are in Word for desktop. So #1 is not supported now but will be soon. Workarounds like #2 and #3 are not available now.
Thanks!
-Michael (Microsoft Program Manager for add-ins)
Thank you for posting this issue and giving us the opportunity to find a resolution. It looks like we are having a temporary issue at present where the Office Add-ins width is getting saved to 3 pixels. We are striving to find a resolution as soon as possible. In the mean time you can try the following workaround
Temporary workarounds:
1.Opening the file in excel client app and saving the file will fix the width issue because we have a minimum width set in excel client app.
2.open the file in open xml editor, locate \xl\webextensions\taskpanes.xml and edit 'width' property of entry to a greater value, say, 300.
After the file is edited in client or excel client, excel client respects the new value and it do NOT go back to value 3. The issue seems to be only repro with the add-ins inserted in excel WAC only.
We will update the article once it is fixed
Thanks,
Sky
Microsoft Program Manager.

Reactivating COM AddIn with Word Interop

I've written a custom ribbon for word. In my winForms-application I also open a word document with word-Interop to create some texts with word.
When I use normal word documents my ribbon is shown correct but when I open the document in my application then the ribbon is gone.
I found out that it is somehow disabled in the COM-AddIn-Options in Word. When I reactivate it manually it appears.
How can I reactivate it programmatically?
[Update]
For better understanding: I have two solutions.
1) A AddIn for Word which displays a ribbon
2) A winform-application which has a winword-control which loads word in it.
When the second one is started the first one is not available anymore.
To answer your question, it's not possible to programatically re-enable your add-in from the add-in itself. Think about it - it doesn't get loaded, so its code won't get run. So nothing you put in your code will re-enable the addin, because it won't get executed.
The only way would be to create a watchdog process that checks if the COM add-in has been disabled every 10 minutes or so, and re-enables it. You'll need to know where Word stores those settings though.

VSTO Addin does not load when Document created from Template and VSTO Customization Error, WHY?

i have created a VSTO addin in VS 2008 for Office 2007. it loads perfectly when Word is started as a standalone.
i have another application that starts a Word document, using a template and fills up the required details in the template.
The problem is that when Word is started from this application, the addin is not loaded,
and the Event viewer shows an error :
Customization URI: file:///C:/Program Files/S2B/S2B Office 2007 Addin/S2B.Word2007.vsto
Exception: The deployment manifest could not be downloaded because a connection to the network could not be established. Ensure that you can connect to the network, and try again.
the addin files(*.vsto), the manifest files(S2B.Word2007.dll.manifest) and other dlls required for the addin are stored in the "C:/Program Files/S2B/S2B Office 2007 Addin/" folder and there is no network involved in the entire operation.
the addin is independent of the application.
If i start Word standalone, the addin is loaded and if i them create the Template document from the application, then the Addin is loaded and i can use its
functionality, there is no problem here.
Why this strange behavior AND how do is solve the error ??
Haven't tried that particular combination myself, but it almost sounds like an issue with how you're starting Word from the "other" app.
Have you tried starting word, just bare, from the other app, using, say CreateObject, and the automating the load of the template and subsequent new doc? I wouldn't think it'd make a difference, but....
Finally, when you say "i have another application that starts a Word document, using a template and fills up the required details in the template"
Exactly how is the other application starting word? that might provide some clues.