<CharlieDigital/> Programming, Politics, and uhh…pineapples


Disabling Office 2003 Browser Inline Behavior

There's a unique problem in an Office 2003 environment that may be encountered by add-in developers.  Namely, by default, Office 2003 documents, when opened from a URL (for example, clicking on a link in an email or typing a URL into a browser address bar) will cause the document to open "inline" with the browser.


The problem with this, for add-in developers, is that while the WINWORD.EXE process is indeed launched, the add-in is not loaded (I'm still not sure why, but I'm guessing it's due to the different security restrictions of being "hosted" in Internet Explorer).  Aside from this, it's generally problematic because the default menu bars and toolbars are not displayed by default...not the ideal behavior.

As it turns out, in Office 2007, the behavior is entirely different: the document always open in a standalone WINWORD.EXE process.  So how can we get Office 2003 to behave the same way?  A series of articles lead the way to an answer:

First, Microsoft actually has a KB (927009) which advises how to enabled Office 2003 behavior in an Office 2007 environment.  This is the first clue that the core of the issue is a series of registry keys.  Knowing which keys to look for, I simply checked the keys in an Office 2007 environment to get the values which would cause an application like Word to launch in standalone mode instead of inline mode (decimal 44 in the case of Word).

The next step was figuring out how to adjust these values in existing deployments.  One option would have been to use a similar registry script as porposed in the KB but I decided to use a programmatic approach instead.  I came across some hints on how to approach this task from a forum posting and MSDN articles.

The outcome was this script:


   This file contains the scripts which are executed after installation of the 

   Office 2003 client update registry keys which would otherwise force Office 

   documents to open in Internet Explorer (inline behavior)


// Key paths

var commonRootPath = "HKLM\\SOFTWARE\\Classes\\";

var commonPath = "SOFTWARE\\Classes\\";

var commonKey = "BrowserFlags";

var HKLM = 0x80000002;

// Instantiate the shell.

var shell = WScript.CreateObject("WScript.Shell");

// Holds the values for the key types

var keyTypes = {






// Holds the array of all key paths (not including the shared "BrowserFlags" 

// DWORD key name) and the value to assign to the key (different for each

// runtime).

var keys = [

    {Class:"Word.Document", Value:44},

    {Class:"Word.Document.6", Value:44},

    {Class:"Word.Document.8", Value:44},

    {Class:"Word.Document.12", Value:44},

    {Class:"Word.RTF.8", Value:44},

    {Class:"Word.DocumentMacroEnabled.12", Value:44}



    Main method.


function Run() {

    try {

        for(var i = 0; i < keys.length; i++) {  

            var key = keys[i];

            if(RegistryKeyExists(key.Class)) {            

                var keyPath = commonRootPath + key.Class + "\\" + commonKey;                              

                shell.RegWrite(keyPath, key.Value, keyTypes.Number);



	    shell.Popup("Updated registry keys.", 0, "Completed", 0 + 64);


    catch(all) {

        // Failures are considered non-fatal.

        var errorMessage = "A non-fatal error occurred while configuring Word 2003\r\n";

        errorMessage += "document handling in IE.\r\n\r\n";

        errorMessage += "You can re-run this script at a later time from:\r\n\r\n";

        errorMessage += "[Program Files]\\[Common Files]\\FirstPoint\";

		errorMessage += "UpdateOffice2003RegistrySettings.js\r\n\r\n";

        errorMessage += "Press OK to continue.";

        shell.Popup(errorMessage, 0, "Error", 0 + 48);




    Checks to see if a registry key exists.


function RegistryKeyExists(className) {

    var registry = GetObject("winmgmts:\\\\.\\root\\default:StdRegProv");   

    var path = commonPath + className;       

    var value = registry.GetStringValue(HKLM, path, "");

    return value == 0;



    Abstracts Popup()


function Alert(string) {

    shell.Popup(string, 0, "Message", 0);



Perhaps the most useful little tidbit in all of this is the RegistryKeyExists method which checks to see a registry path exists.  A return value of 0 from any of the Get[KeyType]Value() method calls indicates that the path was found; it's a very neat little trick to have up your sleeve.

Posted by Charles Chen

Filed under: Dev Comments Off
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.