How COM works & How to build a COM visible DLL in C#.Net, call it from VBA and select the proper ClassInterface (AutoDispatch, AutoDual) [part1/2]

  This article is split across two blog posts and this is part #1.. use this link (please be patient :), I am still working on part 2) to go to part #2. When a beginner programmer needs to create a COM visible DLL which will be called from VBA, PowerShell, VBScript or .NET applications, he can find lots of tutorials on how to…

2

VSTO – How to build a setup project which targets x64 bit OS, and add custom Registry Launch Condition that checks if a key is found in the native 64bit registry hive.

A developer that needs to learn all about building and deploying a VSTO 2010 installer project, should carefully review this very nice article: http://msdn.microsoft.com/en-us/library/ff937654.aspx (Deploying a Visual Studio 2010 Tools for Office Solution Using Windows Installer). Starting from the 2010 version, Office applications come in two flavors: x32 bit and x64 bit. If you need to take advantage of the x64 bit…

2

VSTO – .Net code throws ‘System.AccessViolationException’ error when automating the ‘Find’ object in Word (KB 292744 BUG: Automation client receives an error message or crashes when the client calls the Find object in Word)

Sometimes users are running versions of Office which are not fully up-to-date. This might be due to the fact that their local IT department has not tested the new patches and did not approve their company wide distribution, or because the machine is not connected tothe Internet and needs to be manually updated .. or some other reason. At the same…

1

OpenXML & VSTO & VBA – Finding a reliable mechanism for reading the correct value of CharactersWithSpaces ‘extended-properties’ in Word documents [part 2/2].

  This article is split across two blog posts and this is part #2 .. use this link to go to part #1. In part #1 of this article, I demonstrated how words are counted using OpenXML and I warned about the dangers of not getting it done correctly. Here is a short summary of the alternatives we have:    Can we obtain 100% reliable statistics? Method #1:       When Word…


OpenXML & VSTO & VBA – Finding a reliable mechanism for reading the correct value of CharactersWithSpaces ‘extended-properties’ in Word documents [part 1/2].

  This article is split across two blog posts and this is part #1 .. use this link to go to part #2. There are many scenarios when we have to know exactly how many words, pages, paragraphs or characters are found in a certain document:    > we might be developing a tool which searches through files; If we want to add OpenXML files to       its list of…


VSTO & VBA – How to troubleshoot Excel memory and performance problems caused by inefficient code loops

When working with Excel, a developer sometimes has to search, read or write some cell values and these operations are usually done inside repetitive loop structures. Everything seems to work fast enough for small input files, but once we scale up the design, things can complicate and the end-user experience is severely affected. On the other hand, the developer takes…

5

How to troubleshoot the error message: "The following Microsoft Office solution cannot be installed due to a general installer error: <add-in name>.vsto. 0x80131604" when trying to install a VSTO 2010 Add-in.

      Suppose you develop a simple VSTO Add-in using Visual Studio 2010 and you target the .Net Framework 4.0. When you finish setting up the application’s basic functionalities, you want to test if it runs. Here is a very basic Excel add-in, that should load without any issues: ThisAddIn.cs———————————————————————- using System; using System.Collections.Generic; using…

1

Deploying a Shared COM add-in for Office 2003 (Visual Studio 2008 SP1) [and how to work around a known issue which causes the add-in to fail to load if KB908002 is not installed.]

  Office add-ins can target an application (or many applications if they are Shared COM Add-ins) or only a document. The article http://msdn.microsoft.com/en-us/library/hy7c6z9k.aspx (Office Solutions Development Overview) describes the difference: Choosing an Office Project Type Visual Studio provides the following types of project templates for Office development: Document-level customizations. This type of solution is associated…

1