<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ManvirSingh.net &#187; Office Automation</title>
	<atom:link href="http://www.manvirsingh.net/index.php/category/officeautomation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.manvirsingh.net</link>
	<description>Manvir&#039;s Blog!</description>
	<lastBuildDate>Tue, 01 Jun 2010 09:21:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Demystifying Microsoft Office Object Model &#8211; Part 2</title>
		<link>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-2/</link>
		<comments>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-2/#comments</comments>
		<pubDate>Sun, 23 May 2010 03:16:00 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office Automation]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[powerpoint]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=67</guid>
		<description><![CDATA[Hello everyone! In the last post we left off with a small example of how to automate Microsoft Office applications from our custom solutions. This week we are going to discuss about what does Microsoft Office object model means, and will discuss about various classes/interfaces available in the Office applications. As I had mentioned earlier, [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone! In the last post we left off with a small example of how to automate Microsoft Office applications from our custom solutions. This week we are going to discuss about what does Microsoft Office object model means, and will discuss about various classes/interfaces available in the Office applications.</p>
<p>As I had mentioned earlier, Microsoft Office applications (from now on, wherever I mentions this term, I am referring to Microsoft Word, Excel, and PowerPoint) are also COM (Component Object Model) servers. This enables them to provide a way for developers to use their features in other programs.</p>
<p>As a developer, all you need to do is call a function to launch the server, and once it is up and running, you can ask for the various interfaces provided by the server and utilize its functionality into your application.</p>
<p>The task of launching an Office application from your program can be performed in different ways depending on whether you are linking to the COM server’s type library statically, or you want to launch it dynamically. While linking statically, all you need to do is call the constructor of the main class of the COM Server and then you can access the other Interfaces by using properties/methods of the main class object. Linking dynamically involves calling <em>CoCreateInstance</em> API specifying either the CSLID or ProgID of the application to launch. In the example code of my <a title="Demystifying Microsoft Office Object Model - Part 1" href="http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-i/" target="_blank">previous post</a>, we have seen the static linking technique.</p>
<p>Each of the Office applications provide their main class by the name <strong>Application</strong>, and<em> </em>rest of the Interfaces/Classes that we can use are exposed as Properties of the Application class. It represents a running instance of the Sever and provides methods to manipulate its state like, activating it, setting its visibility etc.</p>
<p>After the Application class, each Office application provides a class that represents the document it works on. In case of Word it is Document class, for Excel it is called Workbook and in case of PowerPoint it is named as Presentation. The Application class maintains the list of all currently opened documents and provides a property that represents this collection. To access a particular document, we need to first get the collection and then find our required document object.</p>
<p>In case of Excel and PowerPoint, each working document contains another level of isolation for its contents. Excel provides separate Worksheets in a workbook and a PowerPoint presentation contains various Slides. You might say that even Word documents contain various Pages, and you are very right. However, Word doesn’t provide page as another isolation of its content. All of the content of a document is represented by the Document class only.</p>
<p>Ok, I think that is enough of the theory; let’s see how this architecture of Office applications can be depicted:</p>
<p> <img style="display: inline; border: 0px;" title="Office Object Model Architecture" src="http://www.manvirsingh.net/wp-content/uploads/2010/05/OOM12.png" border="0" alt="Office Object Model Architecture" width="640" height="335" /></p>
<p>As shown above, Range class is common to Word and Excel, and it represents the portion of the content that can be manipulated with these applications. In case of Word, it could represent a paragraph, a line of text, or a single word. In case of Excel, it represents a collection of Cells, or a particular cell. In PowerPoint, the content of a slide is represented by a collection of Shapes, i.e., each item of a slide in PowerPoint is a shape.</p>
<p>A point to be noted here is that even though I have mentioned Range/Shape as THE object to manipulate content in Office application, it not the only one. There are other objects, too, that can be used to play around with the content of these applications. Here is a small list of such objects:</p>
<ul>
<li>Word
<ul>
<li>Selection – type of Range object</li>
<li>Shapes – represents drawings, embedded images or objects, etc.</li>
<li>InlineShapes – shapes that are displayed in-line with text</li>
</ul>
</li>
<li>Excel
<ul>
<li>Rows – Range object representing a row of data in Excel</li>
<li>Columns – Range object representing a column of data in Excel</li>
<li>Cells – another Range object, for a single/multiple cell(s)</li>
<li>Shapes – represents drawings, embedded images or objects etc.</li>
<li>Selection – Represents any selected item on the sheet, could be a Cell, a Range of cells, or a Shape etc.</li>
</ul>
</li>
<li>PowerPoint
<ul>
<li>Selection – represents a currently selected object on the slide</li>
<li>SlideRange – object to manipulate single or multiple slides</li>
<li>TextRange – object to manipulate a selected piece of text</li>
<li>ShapeRange – object representing a collection of shapes</li>
</ul>
</li>
</ul>
<p>In <a title="Dymistifying Microsoft Office Object Model - Part 1" href="http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-i/" target="_blank">Part-1</a> of this post, we saw code snippets in VC++ and C# to insert a piece of text in a Word document. If you were to implement similar task for an Excel workbook or a PowerPoint Presentation, you can very easily implement it by knowing what type of object you should work with. For instance, you can use Range or Cell object in Excel, and you can use Shape object in case of PowerPoint.</p>
<p>With this, I am going to end this post. I am sure this post has broadened your view of how to work with Office applications. You can also refer to <a href="http://msdn.microsoft.com/en-us/office/aa905496.aspx">Microsoft Office SDK Documentation and Developer References</a> for more details and list of other classes/objects available to you.</p>
<p>In case you have any queries, please feel free to drop in your comments; I will be more than happy to respond.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alternate Data Stream associated with a Word document gets lost when its converted to latest format</title>
		<link>http://www.manvirsingh.net/index.php/alternate-data-stream-associated-with-a-word-document-gets-lost-when-its-converted-to-latest-format/</link>
		<comments>http://www.manvirsingh.net/index.php/alternate-data-stream-associated-with-a-word-document-gets-lost-when-its-converted-to-latest-format/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 00:11:02 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office Automation]]></category>
		<category><![CDATA[customui]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[ribbonx]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=60</guid>
		<description><![CDATA[It has been a while when I last posted something… and with this post I am making a comeback While working with Word during these days, I encountered a scenario where, if I had an Alternate Data Stream (ADS) associated with Word 97-2003 format document and I converted it to the newest format (DOCX format) [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while when I last posted something… and with this post I am making a comeback <img src='http://www.manvirsingh.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>While working with Word during these days, I encountered a scenario where, if I had an Alternate Data Stream (ADS) associated with Word 97-2003 format document and I converted it to the newest format (DOCX format) in Word 2007, the associated ADS would get lost and there is no way to recover it.</p>
<p>I have posted a programmatic solution to retain this ADS when a document gets converted at:</p>
<p><a href="http://blogs.msdn.com/vsod/archive/2010/04/13/how-to-retain-alternate-data-stream-associated-with-a-word-document-while-converting-it-to-newer-file-format-version.aspx" target="_blank">Visual Studio Office Development (VSOD) Support Team : How to retain alternate data stream associated with a word document while converting it to newer file format version</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/alternate-data-stream-associated-with-a-word-document-gets-lost-when-its-converted-to-latest-format/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Demystifying Microsoft Office Object Model &#8211; Part I</title>
		<link>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-i/</link>
		<comments>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-i/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 13:00:05 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office Automation]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=39</guid>
		<description><![CDATA[After programming with the Microsoft Office applications like Word, Excel, and PowerPoint for some time, I feel that using these applications in your own solutions can be quite overwhelming for the first timers. So, I thought of writing this post to introduce the concepts to everyone who wants to program/use Office applications in their own [...]]]></description>
			<content:encoded><![CDATA[<p>After programming with the Microsoft Office applications like Word, Excel, and PowerPoint for some time, I feel that using these applications in your own solutions can be quite overwhelming for the first timers. So, I thought of writing this post to introduce the concepts to everyone who wants to program/use Office applications in their own solutions.</p>
<p>The idea of this post is to get you acquainted with the generic concepts related to programming Microsoft Office applications (from here on, whenever I use this term I am mainly referring to Word/Excel/PowerPoint; however, this doesn’t mean that other Office applications cannot be automated). I assume that you already know how to create WinForms/MFC projects using Microsoft Visual Studio. So, let’s begin…</p>
<p>Most widely used Microsoft Office suite applications like Word, Excel, and PowerPoint provide developers with various interfaces, using which they can automate many tasks of these applications; called Office Object Model. Office Object Model is nothing, but a set of interfaces/classes/objects (different terms – same meaning) which allows programmers to call/ check/operate various features of these applications programmatically, which is also called <strong>*Automation*</strong>.</p>
<p>Apart from being desktop applications, Microsoft Office Applications are also COM components, which expose custom Interfaces for you to utilize in your own solutions. Using these components in a C++ based application involves using the COM APIs (like <em>CoCreateInstance</em> etc.). On the other hand, if you are creating a .Net framework based application then you need something called Microsoft Office Primary Interop Assemblies (PIA) installed on your machine. These are the assemblies provided by Microsoft for use in .Net applications specifically. You can download these from following URLs:</p>
<ol>
<li><a title="Download: Office 2003 Primary Interop Assemblies" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3C9A983A-AC14-4125-8BA0-D36D67E0F4AD&amp;displaylang=en" target="_blank">Download link for Office 2003 PIAs</a> </li>
<li><a title="Download: Office 2007 Primary Interop Assemblies" href="http://www.microsoft.com/downloads/details.aspx?familyid=59daebaa-bed4-4282-a28c-b864d8bfa513&amp;displaylang=en" target="_blank">Download link for Office 2007 PIAs </a></li>
</ol>
<p>Now, before we get into the thick of things, let’s see what it means to use Microsoft Office applications in custom solutions. We will create two applications, viz., a MFC based Dialog box application and a C# based WinForms application. We will then launch Word from these two, and insert a very magical sentence in a new Word document: “Hello World!”… <img src='http://www.manvirsingh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Create a MFC based Dialog box application. Add a button to your main dialog box; double click on it and Visual Studio will generate a click event handler for your button. Leave it as it is for now, we’ll come back to it in a few minutes.</p>
<p>To be able to automate Word from MFC based application, we need to define (or rather generate) few classes which will handle to task of instantiating required COM interface, and making function calls to these interfaces for us. For this, right click on your project node (in solution explorer window) and select Add -&gt; Class… From the Add Class dialog box, select “MFC Class from TypeLib” template and click Add (you may have to select the MFC node in the Categories tree to see this Template); as below:</p>
<p><a href="http://www.manvirsingh.net/wp-content/uploads/2009/07/Add_MFC_Class.png"><img class="aligncenter size-medium wp-image-40" title="Add new MFC Class from TypeLib" alt="Add new MFC Class from TypeLib" src="http://www.manvirsingh.net/wp-content/uploads/2009/07/Add_MFC_Class-300x221.png" width="300" height="221" /></a></p>
<p>In the Add Class from TypeLib wizard, select “Microsoft Word XX.0 Object Library” (the value of XX will be 12 if you have Office 2007, and 11 if you have Office 2003 installed on your machine). From the list of available interfaces, select the ones shown in the following screenshot:</p>
<p><a href="http://www.manvirsingh.net/wp-content/uploads/2009/07/Select_MFC_Typelib_Interfaces.png"><img class="aligncenter size-medium wp-image-41" title="Select the Interfaces for which Classes will be generated" alt="Select the Interfaces for which Classes will be generated" src="http://www.manvirsingh.net/wp-content/uploads/2009/07/Select_MFC_Typelib_Interfaces-300x255.png" width="300" height="255" /></a></p>
<p>On clicking the “Finish” button, the wizard will generate header files corresponding to the classes which we have selected above.</p>
<p>At this moment, if you try to compile your project, you may receive many errors. This is due to a known issue with MFC Class generation wizard (don’t know if Microsoft knows about this, but at least I know it.. <img src='http://www.manvirsingh.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ), and to fix this open each one of the generated files, and comment the following line:</p>
<p>&#160;</p>
<p style="font-family: &#39;Courier New&#39;">#import <span style="color: red">&quot;C:\\Program Files\\Microsoft Office\\Office12\\MSWORD.OLB&quot;</span> no_namespace</p>
<p>&#160;</p>
<p>This #import is actually not required when using MFC classes generated from TypeLib.</p>
<p>Now, copy and paste the following code snippet in your newly created button’s event handler:</p>
<p>&#160;</p>
<div class="cppcode_1">
<pre>::CoInitialize(NULL); <span class="rem">// Initialize the COM related stuff</span>
VARIANT vMissing; <span class="rem">// VARIANT defining a missing/optional parameter.</span>
vMissing.vt = VT_ERROR;
vMissing.scode = DISP_E_PARAMNOTFOUND; 

CApplication wordApp; <span class="rem">// Variable to hold our Application class object</span>
wordApp.CreateDispatch(_T(<span class="str">&quot;Word.Application&quot;</span>)); <span class="rem">// create the instance of Word</span>
wordApp.put_Visible(TRUE); <span class="rem">// make our instance visible to user</span> 

CDocuments docs(wordApp.get_Documents()); <span class="rem">// Get the Application.Documents collection object</span>
CDocument0 doc ( docs.Add( <span class="rem">// Add a new Document to the Documents collection.</span>
	&amp;vMissing, &amp;vMissing, &amp;vMissing, &amp;vMissing) ); <span class="rem">// All the four input parameters are optional.</span> 

CSelection selection ( wordApp.get_Selection() ); <span class="rem">// Get the current selection/cursor position in the newly created document.</span>
selection.put_Text ( _T(<span class="str">&quot;Hello World!&quot;</span>) ); <span class="rem">// Here goes our magical sentence in the document.</span> 

selection.ReleaseDispatch(); <span class="rem">// free the COM resrouces held by our Selection object.</span>
doc.ReleaseDispatch(); <span class="rem">// free the COM resrouces held by our Document object.</span>
docs.ReleaseDispatch(); <span class="rem">// free the COM resrouces held by our Documents collection object.</span>
wordApp.ReleaseDispatch(); <span class="rem">// free the COM resrouces held by our Application object.</span> 

::CoUninitialize(); <span class="rem">// Clean up previously loaded COM related stuff</span></pre>
</div>
<p>&#160;</p>
<p>Also, remember to #include the four header files in the file where you will paste the above code (XXXDlg.cpp).</p>
<p>That’s it; go ahead compile and run your project. When you click your button, it should launch Word with a new document containing “Hello World!” in it… (isn’t that magical?&#8230; well I told you so <img src='http://www.manvirsingh.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p>If you are a .Net guy, and looking for a similar example in C#, here are the steps you need to perform…</p>
<p>Create a C# based WinForms application; add a button and its click event handler to your form. In the event handler button copy and paste the following code snippet:</p>
<p>&#160;</p>
<div class="cppcode_1">
<pre><span class="kwrd">object</span> vMissing = Type.Missing;        <span class="rem">//object defining missing/optional parameters</span>

<span class="rem">// Create a new instance of Word</span>
Microsoft.Office.Interop.Word.Application wordApp = <span class="kwrd">new</span> Microsoft.Office.Interop.Word.Application();

<span class="rem">// Make it visible to the user</span>
wordApp.Visible = <span class="kwrd">true</span>;

<span class="rem">// Get the Documents collection</span>
Microsoft.Office.Interop.Word.Documents docs = wordApp.Documents;

<span class="rem">// Add a new document to the Documents collection</span>
Microsoft.Office.Interop.Word.Document doc = docs.Add(<span class="kwrd">ref</span> vMissing, <span class="kwrd">ref</span> vMissing, <span class="kwrd">ref</span> vMissing, <span class="kwrd">ref</span> vMissing);

<span class="rem">// Get the current selection/cursor position in the newly created document.</span>
Microsoft.Office.Interop.Word.Selection selection = wordApp.Selection;

<span class="rem">// Here goes our magical sentence in the document.</span>
selection.Text = <span class="str">&quot;Hello World!&quot;</span>;</pre>
</div>
<p>&#160;</p>
<p>Now, before you can compile your project, you need to add reference to the assembly which contains definitions of the classes for used above. For this, right click on the <strong>*References*</strong> folder in your project’s solution explorer, and select Add Reference. From the list of available .Net assemblies select Microsoft.Office.Interop.Word assembly, and click Ok.</p>
<p>Well, that’s it for today. We will discuss about the classes, terms and other related concepts that I have used in today’s snippets in the coming posts, soon. Till then, take care and happy coding <img src='http://www.manvirsingh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<style type="text/css">
<p>.cppcode_1, .cppcode_1 pre { 	color: black; 	font-family: "Courier New", courier, monospace; 	background-color: #ffffff; 	width:100%; } .cppcode_1 pre { margin: 0em; overflow:auto;} .cppcode_1 .rem { color: #008000; } .cppcode_1 .kwrd { color: #0000ff; } .cppcode_1 .str { color: #ff0000; } .cppcode_1 .op { color: #0000c0; } .cppcode_1 .preproc { color: #cc6633; } .cppcode_1 .asp { background-color: #ffff00; } .cppcode_1 .html { color: #800000; } .cppcode_1 .attr { color: #ff0000; } .cppcode_1 .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .cppcode_1 .lnum { color: #606060; } </style></p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/demystifying-microsoft-office-object-model-part-i/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>An MFC based ActiveX may crash Excel 2003 when inserted while recording a macro</title>
		<link>http://www.manvirsingh.net/index.php/an-mfc-based-activex-may-crash-excel-2003-when-inserted-while-recording-a-macro/</link>
		<comments>http://www.manvirsingh.net/index.php/an-mfc-based-activex-may-crash-excel-2003-when-inserted-while-recording-a-macro/#comments</comments>
		<pubDate>Sun, 31 May 2009 01:19:25 +0000</pubDate>
		<dc:creator>Manvir</dc:creator>
				<category><![CDATA[Office Automation]]></category>
		<category><![CDATA[activex]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.manvirsingh.net/?p=10</guid>
		<description><![CDATA[Let’s say we have created an ActiveX control using the wizard in Visual Studio 2008, and have checked the “Available in Insert Object Dialog” checkbox on the last page of the wizard as shown below: As the name suggests, this setting enables the ActiveX control to be in “Insert Object” dialog box, which is available [...]]]></description>
			<content:encoded><![CDATA[<p>Let’s say we have created an ActiveX control using the wizard in Visual Studio 2008, and have checked the “Available in Insert Object Dialog” checkbox on the last page of the wizard as shown below:</p>
<p style="text-align: center;"><img class="size-full wp-image-14 aligncenter" title="MFC ActiveX Control Wizard" src="http://www.manvirsingh.net/wp-content/uploads/2009/05/mfcwizard.jpg" alt="MFC ActiveX Control Wizard" width="614" height="523" /></p>
<p>As the name suggests, this setting enables the ActiveX control to be in “Insert Object” dialog box, which is available in most Compound Document container applications, such as, Wordpad, Word, Excel, PowerPoint, etc.</p>
<p>Now, when we insert such an ActiveX to Excel 2003 (using this Insert Object dialog box) while we are recording a macro; Excel may crash.</p>
<p>This happens because the default MFC implementation of the ActiveX enables it to capture the focus when instantiated. So, when we insert it to Excel while recording a macro, our ActiveX gets the focus and this causes Excel to crash.</p>
<p>If our ActiveX is not a compound document object (like Word document, PowerPoint spreadsheet etc.) then we can avoid this crash by modifying our ActiveX code generated by the MFC wizard. Here are the steps to achieve this:</p>
<ol>
<li>Open the <em>ActiveX</em>Ctrl.cpp file (here <em>ActiveX</em> is the name that you have given to your control).</li>
<li>Scroll down to the following comment and code block:</li>
<p style="text-align: left; padding-left: 60px;"><code>// Control type information<br />
</code></p>
<p style="text-align: left; padding-left: 60px;"><code>static const DWORD BASED_CODE _dwAxTest1OleMisc =<br />
OLEMISC_ACTIVATEWHENVISIBLE |<br />
OLEMISC_SETCLIENTSITEFIRST |<br />
OLEMISC_INSIDEOUT |<br />
OLEMISC_CANTLINKINSIDE |<br />
OLEMISC_RECOMPOSEONRESIZE;</code></p>
<p style="text-align: left; padding-left: 60px;"><code><br />
</code></p>
<li>Now OR a new flag <strong>OLEMISC_NOUIACTIVATE</strong> to the above list, as below:</li>
<p style="padding-left: 60px;"><code>// Control type information</code></p>
<p style="padding-left: 60px;"><code>static const DWORD BASED_CODE _dwAxTest1OleMisc =<br />
OLEMISC_ACTIVATEWHENVISIBLE |<br />
OLEMISC_SETCLIENTSITEFIRST |<br />
OLEMISC_INSIDEOUT |<br />
OLEMISC_CANTLINKINSIDE |<br />
OLEMISC_RECOMPOSEONRESIZE |<br />
<span style="color: #ff0000;"><strong>OLEMISC_NOUIACTIVATE</strong></span>;</code></p>
<p style="padding-left: 60px;"><code><br />
</code></ol>
<p>This flag ensures that our ActiveX will not get activated (or gain focus) when it is instantiated, thereby avoiding the crash in Excel 2003.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.manvirsingh.net/index.php/an-mfc-based-activex-may-crash-excel-2003-when-inserted-while-recording-a-macro/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
