open vsto thisworkbook from windows application - excel

I am trying to add VSTO Excel Document Level project using an existing .xlsx document to an existing windows form application project. I have put reference from the Windows App to the VSTO project and manage to import the VSTO project into the Windows App, in addition I have also imported Microsoft.Office.Interop.Excel in the Windows App.
Question is, how to open the Excel Doc in the VSTO from within the Windows App and link withevents the "Thisworkbook" of the Excel doc in the VSTO (like calling globals.thisworkbook)?
I have tried to open directly the excel doc from the win app, however, the code within the vsto doesn't work.
Bunches of thanks for your help!

Related

How to reload Excel add-in for Desktop Version

We deployed Excel add-in project which was developed in Office Js in intranet. And manifest file uploaded in Office 365 admin center to reflect users. But it is working in Office online Excel version only. But in desktop version it is not getting refreshing and only showing old changes. Kindly help on this so that it can be upload with new changes to get reflect.
You can remove an add-in that you've previously sideloaded on Windows, Mac, or iOS by clearing the Office cache on your computer.
Additionally, if you make changes to your add-in's manifest (for example, update file names of icons or text of add-in commands), you should clear the Office cache and then re-sideload the add-in using updated manifest. Doing so will allow Office to render the add-in as it's described by the updated manifest.
To remove all sideloaded add-ins from Excel, Word, and PowerPoint, delete the contents of the folder:
%LOCALAPPDATA%\Microsoft\Office\16.0\Wef\
To remove a sideloaded add-in from Outlook, use the steps outlined in Sideload Outlook add-ins for testing to find the add-in in the Custom add-ins section of the dialog box that lists your installed add-ins. Choose the ellipsis (...) for the add-in and then choose Remove to remove that specific add-in. If this add-in removal doesn't work, then delete the contents of the Wef folder as noted previously for Excel, Word, and PowerPoint.
Additionally, to clear the Office cache on Windows 10 when the add-in is running in Microsoft Edge, you can use the Microsoft Edge DevTools.
Read more about that in the Clear the Office cache article.

Make an Excel COM add-in a VSTO add-in

I have coded an Excel add-in using Visual C#. This add-in appears as a COM add-in in Excel. However, I am quite sure that it used to appear as an Excel/VSTO Add-In in Excel before an update of Visual Studio. (I know that I was able to access the Globals class. This thread says that Globals can only be accessed in Excel add-ins.)
So my question is: How can I make my COM add-in an Excel/VSTO add-in?
When you create an Office project, Visual Studio automatically generates a class named Globals in the project. You can use the Globals class to access several different project items at run time from any code in the project.
You can start writing your VSTO Add-in code in the ThisAddIn class. Visual Studio automatically generates this class in the ThisAddIn.vb (in Visual Basic) or ThisAddIn.cs (in C#) code file in your VSTO Add-in project. The Visual Studio Tools for Office runtime automatically instantiates this class for you when the Microsoft Office application loads your VSTO Add-in. Read more about that in the Program VSTO Add-ins article.
Also, see Walkthrough: Create your first VSTO Add-in for Excel.
Well, if you used Microsoft.Office.Interop.Excel.... thats COM... Interoperability. VSTO is a COM.

Office add-in Excel VSTO office 365 (desktop) support

Do you know if this is possible to create a VSTO add-in for excel in an office 365 suite (on desktop, of course)?
Officially, it says it is supported.
But, if I create an empty project on VisualStudio with the default "Office 2013 & 2016 VSTO add-in", it does not load.
But, it works on other machines, with excel 2016.
Can you help me with this?
I already tried many things. And, it seems that the add-in does not even show in the list of COM add-ins in the setup menu. It's not disabled; and, if I look at the registry, the load behavior is 3.
The only strange thing that I found is that when I try to link manually the .dll file using the "add-in" menu, it says that the dll is not a valid excel add-in.
But, if I do it another way and click to the .vsto file, the explorer says that the add-in has been installed correctly..
Thanks a lot

Uninstallation of Excel Addin not removed from MS Excel Addin tab/custom tab

I have an application that is developed using CommanBar tools. As there are much constraints in that, i have planned to shift to the Ribbon(view designer). I created a project like, File->New Project->Excel 2007->Excel Addin for 2010.
Created a sample addin and added a new project to the same solution as I wanted the addin to be added using installer(.msi). I registered the Com Addin in the Registry, but on uninstallation, the files are getting removed only in the registry entry, but not in the MS Excel, the addin still to be remained there. Please help me in this. As I am new to the implementation of Ribbon implementation.
I have used winform c# 4.0.
Thanks in advance.
#kiru - the screen shot for the path you mentioned
Check the path from where the addins are been loaded.
Open Excel
Click File => Options => Addins (Tab)
Select COM Add-ins in Manage dropdown box and click Go
Select the addin and you can see the path where it is been loaded.
If it is from bin directory then follow this
If you are running your msi on development pc clean your solution every time you test your msi.

Not a valid Office Add In

I developed a new Office 2007 addin using VS 2008 and VSTO. after this I go to
Office->Excel Options->AddIns->COM AddIns and GO... If I select the .dll which I ve created I get the error
'<path>' is not a valid Office Add In.
If I run it using the Visual Studio 2008 at my development machine, it works fine and I see the add-in.
I searched so many posts but didn't get a solution.
Excel kept rejecting the Add-In, so the solution for me was doing it directly via the registry.
Save the below text as a .reg file, replace the Manifest path and FriendlyName to suit your PROJECT and double click the reg file to add the key to the Registry.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\PROJECTExcelAddIn]
"Manifest"="file:///C:\\TFS\\Pg.PROJECT\\PROJECTExcelAddIn\\Src\\PROJECTExcelAddIn\\PROJECTExcelAddIn\\bin\\Debug\\PROJECTExcelAddIn.vsto"
"FriendlyName"="PROJECTExcelAddIn"
"LoadBehavior"=dword:00000003
"Description"="PROJECTExcelAddIn - Excel add-in for PROJECT."
VSTO does not create COM Addins. You will need to install your add-in on non-development machines. The article Adding the Office Primary Interop Assemblies as a Prerequisite in your ClickOnce installer at http://blogs.msdn.com/vsto/archive/2008/05/08/adding-the-office-primary-interop-assemblies-as-a-prerequisite-in-your-clickonce-installer-mary-lee.aspx will get you started.
Actually, you'll have to publish the addin. Then, the Visual Studio will create a folder in Debug folder named app.publish folder with other folders in and, the important thing, a setup file named setup.exe.

Resources