Activex OLE Delphi

Title: Opening Office Documents (Word, Excel) in TWebBrowser on Vista and Office 2007
When, in your Delphi application, you are using the TWebBrowser control to open Word (Excel) document for preview and/or print - if your application is running on Vista with Office 2007 installed you might experience weird behaviors.
By default, when you try to navigate to and open a Microsoft Office Word 2007 document, (Excel or PowerPoint) in the TWebBrowser control (embedded IE), the document may not open in the "same window" - instead a new Word 2007 (Excel 2007, PowerPoint 2007) window opens to display the document.
Forcing "Browse in the same IE window"
In Office 2003 the default behavior was to open a document in the same (IE) window - in Office 2007 the default is to open the document in a new/separate window.
In order to get the document open inside the web browser control you will need to alter a few registry entries on the client machine.
Work 2007:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.8]
"BrowserFlags"=dword:80000024

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.12]
"BrowserFlags"=dword:80000024



Excel 2007:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.8]
"BrowserFlags"=dword:80000A00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.12]
"BrowserFlags"=dword:80000A00

Of course, you can modify the registry programmatically using Delphi code.
Note that this is a "hack" and this Internet Explorer feature may not exist in future operating systems that are later than Windows Vista.