Word Addin application not displayed in the Word ribbon - vsto

I made a Word add in application in VS 2010 in C# and it was working fine until I installed the app using Advanced Installer in my development PC and its doesn't display anymore in the Word ribbon. I check the registry files and it looks fine, tried to add the same registry keys in the HKEY_CURRENT_USER and the HKEY_LOCAL_MACHINE directories in the registry Editor window but still no effect.
I even create another add in as a test and it wasn't displayed in the word ribbon.
When I check the Addin options in the Word option window the addin is located in the Active Application Addin which indicates that addin is loaded and working but still can't be displayed in the word ribbon.
I also tried to re-install the whole office package and restore the PC configuration to the date before installing the app but still nothing works.
The registry keys I use for the Addin are listed below:
Description: My_Addin
FriendlyName: My_Addin
LoadBehavior: 3 (DWORD (32-bit) value)
Manifest: file:///C:/Application folder/My_Addin.vsto|vstolocal

Related

VB and VBA Program Settings are invisible in RegEdit but accessible via VBA

I got a new laptop with 64-bit Windows 10 Home (version 1803) and 32-bit Office 365 (version 1811) installed.
I can use SaveSetting and GetSetting commands via VBA with no problem, VBA saves and reads everything properly.
But I cannot see VB and VBA Program Settings via RegEdit (not under Computer\HKEY_CURRENT_USER\Software, not anywhere else):
The key just does not exist.
I tried both C:\Windows\regedit.exe and C:\Windows\SysWOW64\regedit.exe - neither showed the key.
I created VB and VBA Program Settings with a couple of sections and keys to test via RegEdit - VBA read them all perfectly, but when I changed them via SaveSetting, RegEdit did not show updated values. GetSetting did. After I delete them via DeleteSetting, VBA no longer shows them but RegEdit still does.
I ran a search for the key added via SaveSetting, it came up with no results.
I cannot see VB and VBA Program Settings via PowerShell or PowerShell(x86) either. I cannot see them in the text file that I export the registry to.
It seems like a Windows or Office bug. Any ideas how I can see actual values under VB and VBA Program Settings via RegEdit?
OK, I have no idea what it was but reinstalling MS Office fixed the issue. My original Office was pre-installed on the laptop, courtesy of Lenovo. I uninstalled it, then installed it from Microsoft website, and everything seems now back to normal.

VB.Net Word Add-in has automatically installed itself

I am developing an add-in for Word to add ribbon bar functions for our business.
I am developing the add-in in VB.Net using Windows Visual Studio 2017.
The machine is currently a stand-alone machine that is not connected to the main network.
My issue is that for some reason, the add-in seems to have set itself up in such a way that it appears to have already been installed on the system and loads, with the most updated code, if I just start Word normally.
Any development has been done in Debug mode and I have not been re-building the solution in release mode, and yet anything I change and then run/debug updates the code that the add-in appears to be run off when opening Word directly.
If I go through the options --> add-ins and disable the VTSO add-in it just gets enabled again. I don't seem to be able to separate a debug/development section and live code.
Edit from comments: I can accept that the VTSO needs to be installed and registered but having no separation of live code and development code is frustrating. This machine is used by others for other purposes and this includes using Word, and so any old code must be kept as comments that can set back as the working code should I need to leave part way through. I cannot leave anything partially written as any run the debug mode will set the code as live.
What you're experiencing is normal behavior. When you debug, VSTO registers the add-in in the Windows Registry. This is all that's required for the Office application to find and load the add-in when it starts.
If you disable the add-in in Word, it will remain disabled until you again debug the add-in in Visual Studio.
If you share the machine and want to have the add-in under development disabled for other users:
Work with separate user profiles. VSTO registers its add-ins under CurrentUser, not for all users - VSTO isn't designed to register add-ins for the entire machine. OR
Get into the habit of using Visual Studio's Build/Clean Solution functionality when you leave the machine. That unregisters the add-in (until it runs in debug mode again).

Building/deploying a simple Word addin

I am trying to build a simple addin for Word 2007 using Visual Studio 2010 and .NET 4.0. It's a relatively simple addin, which brings up a save dialog and saves the document as a Word 2003 document.
The addin runs fine in Word under Debug mode, but does not run under Release or when I create a setup project for it. (It does create the registry keys under HKCU\Software\Microsoft\Office\Word\Addins and they look to be correct) I don't get any errors, and the addin isn't listed under the Disabled Addins either.
I tried adding the Addin manually but it says that it isn't a valid addin. The version of Office is 32-bit, running under Windows 7 64-bit.
Or are there even any alternatives to using VSTO (VBA?) that will let me add a tab to the Ribbon?
You can use IRibbonExtensibility interface (http://msdn.microsoft.com/en-us/library/microsoft.office.core.iribbonextensibility.aspx) to avoid using VSTO.

How to deploy an Outlook macro?

I made an Outlook macro. How can I deploy it to use it on some other machine?
Do I follow the same steps I followed on my machine Tools-> Macros-> create new or is there another way to deploy as we do with the vb or C# projects?
No, you don't need to follow the same steps and re-record the entire macro from scratch. You can save the module containing the macro and import it in Outlook on the other machine.
In Outlook's VBA editor, right-click your module > Export File...
Then on the other machine, in Outlook's VBA editor, right-click your project > Import File...
EDIT You say that your Outlook doesn't have VB Editor. Quoting from Outlook help:
you may be running a Microsoft Office
program with the Visual Basic for
Applications (VBA) shared feature disabled.
I don't know what version of Outlook you have, but for 2003:
To re-enable VBA, follow these steps:
1.Run the Office Setup program again. How? Quit all programs.Double-click
the Add/Remove Programs icon in the
Microsoft Windows Control Panel.Do one
of the following: If you installed
your Office program as part of
Microsoft Office, click Microsoft
Office in the Currently installed
programs box, and then click the
Change button.If you installed your
Office program individually, click the
name of your program in the Currently
installed programs box, and then click
the Change button.
2.On the Features to install screen in the Setup program, click the plus sign
(+) next to Office Shared Features.
3.Select Visual Basic for Applications, click the arrow next to
your selection, and then click Run
from My Computer.
Usually outlook macros are only made for personnal use. Distributing them can be hard as it needs too much actions made by the user (add "devoloper" in ribbon, open visual basic editor, import files, enable references, enable security...).
Microsoft wrote:
If you are developing a solution that you intend to distribute to more than a few people, you should convert your VBA code into an Outlook COM or VSTO add-in or an Office add-in for Outlook.
(source: https://support.microsoft.com/en-us/help/290779/managing-and-distributing-outlook-visual-basic-for-vba).
Knowing that, i recommend you to write a VSTO add-in and deploy it using ClickOnce.
You can start by these links:
VSTO
https://learn.microsoft.com/en-us/visualstudio/vsto/getting-started-programming-vsto-add-ins?view=vs-2019
ClickOnce deployment
https://learn.microsoft.com/en-us/visualstudio/vsto/deploying-an-office-solution-by-using-clickonce?view=vs-2019

LoadBehavior for MS Word 2007 add-in being set to 2

I have an add-in for MS Word. One of my users, who is on Word 2007, reports that the add-in is not being loaded. When she checks the COM add-ins list, it says "Load Behavior" is "Unloaded; Load at Startup" (value of 2 in LoadBehavior registry entry).
Yet when she checks the add-in's registry entry, LoadBehavior is set to 3 (Loaded; Load at Startup). The add-in is also not loaded at all.
Is there some reason for the discrepancy between what Word is reporting for the add-in, and what's in the registry, and is there a way to resolve it?
I have a hunch that Word has set a LoadBehavior value somewhere else on her system after the add-in crashed, but she is remote from me, and doesn't want me to remote control her computer to check myself.
Edit: Some additional info: if the user runs a macro to check my add-in in Application.COMAddins, Connect is set to False. However, updating this to True doesn't seem to have any effect. The property will stay True as long as Word is running, but if Word is restarted then it will revert to False (and the add-in is never loaded).
More information: The add-in had been disabled due to a crash, and put in the disabled add-ins list. The user enabled the add-in from the COM add-ins drop-down list, but the load behavior was then stuck on 2, despite the registry value being 3. WinWord.exe doesn't have any compatibility settings.
Also, I provide three add-ins: one for Word, one for Excel, and one for PowerPoint. The Excel and PowerPoint add-ins work fine on the user's computer. I test the add-in myself on XP, Vista, and 7 (32 and 64 bit). The user is on Vista 32 bit.
The Word add-in was working on the user's computer for about two years, but after a crash it was disabled, and the LoadBehavior was stuck on 2. The user actually tried uninstalling and reinstalling Office, but that didn't change the behavior.
Solution
0xA3's solution wasn't complete, but on the right track. It turns out that the user had installed a new antivirus program, which was disabling the add-in (silently! ::insert rant about overzealous AV::).
I also learned a valuable lesson: to some users, "Have you installed any new software" doesn't include antivirus programs. I'll have to change that question to, "Have you installed any new software, or any antivirus programs?"
As said by Otaku, the problem seems to be that the add-in cannot be loaded and therefore is disconnected. It might due be an incomplete/corrupt installation of the add-in, a missing dependency or incorrect/missing registration of a COM component.
It's hard to give you more concrete tips, but here is a list of trouble-shooting tools that you might want to use during Word startup:
DebugView from Sysinternals, run as Administrator, with Capture Global and Capture Kernel enabled.
fuslogvw.exe to check for missing assemblies (assuming your add-in is written in .NET)
DependencyWalker to see for missing native dlls
Process Monitor to check for missing files/registry entries
Is there some reason for the discrepancy between what Word is reporting for the add-in, and what's in the registry, and is there a way to resolve it?
The reason for the discrepancy between the Registry and the actual Word setting is most likely that the current add-in state (loaded, but disconnected) is not stored in the Registry at all because the user has no sufficient permissions to change the HKLM Registry key. The LoadBehavior remains 3 in the Registry, and on next Word startup Word will try again to load and connect the add-in.
Addins can be registered in the USER hive or the LOCAL MACHINE hive, same folder in each.
HKEY_CURRENT_USER\Software\Microsoft\Office\Word\Addins\Your addin name
or
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Word\Addins\Your addin name
be sure to check both.
FYI : I was having similar issue with Excel AddIn. Excel "blacklisted" the add-in due to an error (which has not necessarily generated any error message). Go to: AddIns > "Disabled items" > Enable Addin resovled the issue for me.