3. Introducing Sample Excel Extension

This is the third post in this series on the extensibility of Coded UI Test. Before reading this, you should read the previous posts of this series to better understand this post.

In this and next few posts, I will explain a sample extension that we have for Microsoft Excel. The worksheet (Grid like) control of Excel is a custom control and the cells in this control are not visible to Coded UI Test by default. The sample extension attached to this post uses the extensibility that I have mentioned in this series to make the cells inside the Excel Worksheet region visible to Coded UI Test as control with customized properties. Before continuing further, see the demo video of this extension in action –

To play with the sample, copy it locally and do a clean build. Use the CopyDrop.bat or refer step 5 in the blog 2 of this series to deploy the sample.

Now, let me explain the high level architecture and components of this extension. The architecture looks like –


The sample has 3 modules –

  • Excel Extension (Microsoft.VisualStudio.TestTools.UITest.Sample.ExcelExtenision.dll) – This is the extension using the Coded UI Test extensibility APIs. We will discuss this in detail.
  • Excel Add-in (Microsoft.VisualStudio.TestTools.UITest.Sample.ExcelAddin.dll) – This is an Excel add-in written using Visual Studio Tools for Office (VSTO). This add-in resides in Excel process and uses Excel object model to get information required by Coded UI Test. The code here is simple and not exactly relevant in understanding the Coded UI Test extensibility. Hence I will not go into the details of this module – the code is well commented and you will be able to follow it.
  • Excel Communicator (Microsoft.VisualStudio.TestTools.UITest.Sample.ExcelCommunication.dll) – The Excel Extension residing in Coded UI Test process communicates with Excel Add-in in Excel process using .NET Remoting. This module is just the interface definition for this communication.

The below table dives into Excel Extension at class\file level –


Description and use

Detail in blog

ExcelTechnologyManager, ExcelElement, ExcelWorksheetElement and ExcelCellElement

The main classes in this extension related to implementing the technology adapter for Excel. The ExcelTechnologyManager implements UITechnologyManager and other classes implement UITechnologyElement.

Blog 4 of this series


An action filter (aggregation rule) specific to Excel. This class implements UITestActionFilter.

Blog 6 of this series


The property provider for Excel. This class implements UITestPropertyProvider.

Blog 5 of this series


The package entry point. This is similar to HelloWorldPackage class covered in Blog 2 of this series.

Blog 2 of this series


Singleton instance to manage the .NET Remoting interface that is used to communicate with Excel Add-in.



Various simple utilities and PInvoke definitions.


The sample is a basic sample for Excel support and is in no way near complete. The sample should be used for understanding the extensibility concepts and not as the real support for Excel.

The complete source code for this sample is here.

Proceed to blog 4 of the series to understand the code for this sample.



Comments (17)

  1. Sean says:

    I'm having problems getting this addon to run. I'm in VS 2010 Premium and running office 2010. I got a successful build and I ran the copy.bat and I still cannot select and individual cell.

  2. Sorry for late reply.  For some reason, my blog settings got messed up and I had trouble login in.  In general, the Coded UI Test forum (social.msdn.microsoft.com/…/threads) is better place to post your questions as that is monitored by many folks & you will get faster response.

    This sample was developed with Excel 2007 but I know folks have got it working for Excel 2010 with minor modification which I don't remember.  See if you can debug the problem.



  3. Rahul says:

    I am having problem building the solution on namespace Microsoft.Office.Tools.Excel.Extensions.

  4. This could be because you don't have Visual Studio Tools for Office on your machine.

  5. Can you please suggest me how to make it work with Office 2010? I ran copy.bat file and still was not able to identify the cells in excel.

  6. @Kranthi – Did you open the solution in VS and build it?

  7. purinder says:

    I tried to execute the sample  but once i reached – dragging the crosshair to excel cell… it gives an error (CodedUIBuileder.exe has stopped working)…

  8. Difficult to say based on just this info.  Since the source code is there and this blog covers how to debug extensions, I suggest you give it a shot.


  9. chetan says:

    Do you have any sample to automation java applications

  10. I am able to build the add-in solution and copied the files using copydrop.bat.

    When I tried use the recorder on excel,  i am getting this error "Failed to connect to an IPC Port: The system cannot find the file specified."

    Please help me in solving this.

  11. Murali – Are you still facing this?  Try running the plugin once with VS.

  12. Hi Gautam,

    I am facing the same problem which is stated above by Mr.Purinder,

    When i point out with cross above the cell, blue colored rectangle is rounded up the cell and when my mouse up the popup displays and at once the UITestBuilder is stopped working.

    I have read the debugging procedure and by placing break points in the Extension Package, Technology manager and the Property provider, nothing got hit.

    waiting a solution,


  13. Ankit Verma says:

    This error is coming when i am running test case…

    System.ArgumentException: The following is not a valid technology name: Excel. To search for a control, you must specify a valid technology name.     Parameter name: TechnologyName

  14. @Ankit – The plugin has not been registered properly.  Please run it from VS once and try.  If it still does not work for you, I suggest trying MSDN forum for Coded UI Test.

  15. Adi says:

    Is there any Copyright/license requirement for using this code?

    Please let me know.


  16. @Adi – This is sample code and not supported by MS or me.  You can use this to build your own plugin.

Skip to main content