5429 Views // 0 Comments // Not Rated

Circumvent Office Activation

It took me a while to decide if I wanted to blog about this, but I decided that it is something that can make a developer's life a lot easier. There is a workaround to the whole Office 2007 activation wizard. Normally, you have (depending on your version) a certain amount of days or usages of Office before you have to activate it. Although this helps protect against software piracy, I've found it to be annoying when I'm developing against Office.

Also, since we use a lot of VMs, and rebuild our development machines frequently, we quickly blast though our MSDN volume license subscription's maximum allowable number of installations. This is a problem because we write a lot of applications that use or automate Office, and the number of installations that we register always ends up exceeding the actual number that we're using.

The workaround is simple: if you invoke Excel, Word, or any other Office app though its object model, the activation wizard is circumvented, and one of your pre-activation usages is not burnt. This is great for development, because we can activate Office on our main machines and not worry about wasting a license on a dev machine or VM that we are going to throw away regardless.

Here's the code outlining how to do this for Excel:

  1. Add a reference to the Excel 12 object model (found in the "COM" tab of the add reference window).  Make sure that Office was installed after the .NET framework, and that the .NET Programmability options were selected in the Office installation wizard.
  2. Reference it in your class.
  3. Create a member variable to represent the Excel application.
  4. Launch Excel in the load method of a Win form or somewhere else.

Here is the code:

Code Listing 1

  1. using Excel = Microsoft.Office.Interop.Excel;
  2. ...
  3. private Excel.ApplicationClass _excel;
  4. ...
  5. this._excel = new Excel.ApplicationClass();
  6. this._excel.Visible = true;

And there you have it. Run your code, and you will have Excel running normally. This will not count as a pre-activation usage.

Please do not exploit this. I pass this information on a way for developers to be more productive, not to shamelessly steal Office.

No Tags

No Files

No Thoughts

Your Thoughts?

You need to login with Twitter to share a Thought on this post.