<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Office Development with Visual Studio : Excel 2003</title><link>http://blogs.msdn.com/vsto/archive/tags/Excel+2003/default.aspx</link><description>Tags: Excel 2003</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>BUG: “Old format or invalid type library” error when automating Excel (Christin Boyd)</title><link>http://blogs.msdn.com/vsto/archive/2009/07/06/bug-old-format-or-invalid-type-library-error-when-automating-excel-christin-boyd.aspx</link><pubDate>Tue, 07 Jul 2009 01:54:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9820860</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9820860.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9820860</wfw:commentRss><description>&lt;p&gt;A customer recently reported this bug when running their Shared Addin for Excel on French Windows.&amp;#160; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Error: 0x80028018 (-2147647512)      &lt;br /&gt;Description: Old Format or Invalid Type Library&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;His solution worked great on English Windows, but gave errors in any other language.&amp;#160; This is a known problem in Excel and there are a few workarounds that work depending on the way you’re writing your Excel Addin.&amp;#160;&amp;#160; Let me take you through the problem, variations on the problem, and different solutions depending on which Visual Studio project template you choose to start your Addin.&lt;/p&gt;  &lt;p&gt;The bug was originally documented in a &lt;a href="http://support.microsoft.com/kb/320369" target="_blank"&gt;KB 320369 article&lt;/a&gt;, which gives detailed repro steps, explanation, and two workarounds with sample code.&amp;#160; So why am I writing a blog post if the KB article covers everything?&amp;#160;&amp;#160; Three reasons.&amp;#160; &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Because we’re fixing the problem in CLR 4 and I want to encourage you to use one of the recommended workarounds in your current solutions so that you’re ready when your users upgrade to .NET Framework 4.&amp;#160; &lt;/li&gt;    &lt;li&gt;Also, there are parts of the KB article that are a bit confusing, so I’ll try to add some color commentary to help explain what’s causing the problem.&amp;#160; &lt;/li&gt;    &lt;li&gt;And third, these problems do not occur if you use VSTO 2005 SE, VSTO 3.0 (which ships with Visual Studio 2008), or Visual Studio 2010.&amp;#160; I’ll explain why and how later. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The KB article describes the problem:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Error: 0x80028018 (-2147647512)      &lt;br /&gt;Description: Old Format or Invalid Type Library&lt;/p&gt;    &lt;p&gt;You receive this error calling an Excel method when the following conditions are true: &lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;The method requires an LCID (locale identifier). &lt;/li&gt;      &lt;li&gt;You run an English version of Excel. However, the regional settings for the computer are configured for a non-English language. &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;If the client computer runs the English version of Excel and the locale for the current user is configured for a language other than English, Excel will try to locate the language pack for the configured language. If the language pack is not found, the error is reported.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The quote from the KB article is accurate, but can be confusing.&amp;#160; It is very difficult to determine if the Excel method you want to call requires LCID or not.&amp;#160; The Primary Interop Assembly (PIA) does not indicate whether or not the LCID is needed, however VBA does not hide the need for LCID.&amp;#160; Part of the reason why Excel hasn’t changed its methods is to maintain back compatibility with all the VBA code in the universe.&amp;#160; &lt;/p&gt;  &lt;h3&gt;Fixed in VSTO&lt;/h3&gt;  &lt;p&gt;VSTO implemented a fix in VSTO 2005 Second Edition (SE).&amp;#160; You can read more about this fix in &lt;a href="http://blogs.msdn.com/eric_carter/archive/2005/06/15/429515.aspx" target="_blank"&gt;Eric Carter’s blog post&lt;/a&gt;.&amp;#160; The fix is also in all subsequent versions of Visual Studio 2008 and will be in Visual Studio 2010.&amp;#160; You know you are using “VSTO” when you create a new Project in Visual Studio and select an Excel &amp;lt;version number&amp;gt; Workbook, Excel &amp;lt;version number&amp;gt; Template or Excel &amp;lt;version number&amp;gt; Addin.&amp;#160; The fix was not implemented in the Shared Addin template in any version of Visual Studio.&amp;#160; If you create a WinForms, WPF, Web or console application that calls Excel, then you will see this bug on non-English Windows.&lt;/p&gt;  &lt;h3&gt;Workarounds &lt;/h3&gt;  &lt;p&gt;If you are using the Shared Addin template, a WinForm, WPF, Web or Console application with any version of Visual Studio, then you should use the &lt;a href="http://support.microsoft.com/kb/320369" target="_blank"&gt;KB 320369 article&lt;/a&gt; to solve the problem.&lt;/p&gt;  &lt;p&gt;The workaround is to write explicit calls to set the thread’s culture before calling into Excel.&amp;#160; You can then reset the culture back to what it was before after you are finished calling Excel.&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Install the Multilingual User Interface Pack for your version of Office. &lt;/li&gt;    &lt;li&gt;Execute the Excel method or property by using &lt;b&gt;InvokeMember&lt;/b&gt; so that you can specify the &lt;b&gt;CultureInfo&lt;/b&gt; for the call. For example, the following code illustrates how you can invoke the &lt;b&gt;Workbooks&lt;/b&gt; object &lt;b&gt;Add&lt;/b&gt; method with &amp;quot;en-US&amp;quot; as the &lt;b&gt;CultureInfo&lt;/b&gt;:       &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;       &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oApp &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; Excel.Application()&lt;br /&gt;oApp.Visible = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;oApp.UserControl = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oBooks &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt; = oApp.Workbooks&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; ci &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Globalization.CultureInfo = &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; System.Globalization.CultureInfo(&lt;span style="color: #006080"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;)&lt;br /&gt;oBooks.&lt;span style="color: #0000ff"&gt;GetType&lt;/span&gt;().InvokeMember(&lt;span style="color: #006080"&gt;&amp;quot;Add&amp;quot;&lt;/span&gt;, Reflection.BindingFlags.InvokeMethod, &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt;, oBooks, &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt;, ci)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Or, instead of the above bullet and code sample, set the &lt;b&gt;CultureInfo&lt;/b&gt; prior to calling the Excel method, and then you can reset it after your Excel call: &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;
    &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oApp &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; Excel.Application()&lt;br /&gt;oApp.Visible = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;oApp.UserControl = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oldCI &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Globalization.CultureInfo = _&lt;br /&gt;    System.Threading.Thread.CurrentThread.CurrentCulture&lt;br /&gt;System.Threading.Thread.CurrentThread.CurrentCulture = _&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; System.Globalization.CultureInfo(&lt;span style="color: #006080"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;)&lt;br /&gt;oApp.Workbooks.Add()&lt;br /&gt;System.Threading.Thread.CurrentThread.CurrentCulture = oldCI&lt;/pre&gt;

    &lt;br /&gt;&lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;The .NET Framework 4 will solve this whole culture problem.&amp;#160; Excel is not going to change its culture sensitivity because of the need to support backwards compatibility.&amp;#160;&amp;#160; Starting with CLR 4.0, when managed code calls into a COM component and an LCID is required, then the CLR will pass LCID = 1033.&amp;#160; Note that this is how VBA passes LCIDs.&amp;#160;&amp;#160; This means that Visual Studio 2010 project templates for Excel Addins can stop wrapping all Excel projects with LCID proxy.&amp;#160;&amp;#160; In the future, when you use VS 2010 and .NET 4 to write your Excel automation programs from a Shared Addin, console, Winforms, WPF, or Web application, you won’t need to wrap your calls either.&amp;#160; &lt;/p&gt;

&lt;p&gt;-Christin Boyd, Program Manager &amp;amp; &lt;a href="http://blogs.msdn.com/mshneer/" target="_blank"&gt;Misha Shneerson&lt;/a&gt;, Senior Developer&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9820860" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Christin+Boyd/default.aspx">Christin Boyd</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2003/default.aspx">Excel 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VBA/default.aspx">VBA</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>I Just Want to Format a Cell in My Excel Worksheet (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2008/06/03/i-just-want-to-format-a-cell-in-my-excel-worksheet-norm-estabrook.aspx</link><pubDate>Tue, 03 Jun 2008 20:41:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8571844</guid><dc:creator>VSTO Team</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8571844.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8571844</wfw:commentRss><description>&lt;p&gt;So you just want to write some code to format a cell in a worksheet. However, there isn't a help topic in sight that shows you how to do it. There may be a topic out there, but you don't have time to sift through the web searching for it. You're not alone. The forums are filled with questions about how to accomplish what might seem like a simple task - like formatting a cell.&amp;#160; But the search for the right class, method or property to do it is not so simple.&lt;/p&gt;  &lt;p&gt;A great way to get unstuck on some of these small but distracting issues is to use the Excel macro recorder. Start the recorder, pick a cell, format the cell, stop the recorder and then look at the code that Excel generates.&amp;#160; The trickiest part is translating the VBA code to C# or VB so that you can use the code in your VSTO project. However, doing this can be a lot easier than searching the web and MSDN for a topic that shows you which specific class or property in the massive Excel object model you need to perform your task.&lt;/p&gt;  &lt;p&gt;Let's take a look at an example scenario.&amp;#160; All I want to do is format a cell as a percentage with 2 decimal places on the right side. The Macro recorder will show me which method or property I need to use.&lt;/p&gt;  &lt;p&gt;To use the Macro recorder in Excel 2007, you have to enable the developer tab in the Ribbon.&amp;#160; Click the round Office button and then click &amp;quot;Excel Options&amp;quot;. Then select the &amp;quot;Show Developer tab in the Ribbon&amp;quot; as follows.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="653" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="320"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="333" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb.png" width="261" border="0" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td valign="top" width="331"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_12.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="253" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_5.png" width="380" border="0" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Start the macro recorder as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_16.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="276" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_7.png" width="383" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Select a cell and then set your formatting options as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_18.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="309" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_8.png" width="349" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Stop the macro recorder.&amp;#160; Open the macro in the VBA editor as follows:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="653" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="320"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_24.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="308" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_11.png" width="299" border="0" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td valign="top" width="331"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_22.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="275" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_10.png" width="290" border="0" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Grab the generated VBA. For example the VBA generated by the macro that I recorded looks like this:&lt;/p&gt;  &lt;p&gt;Range(&amp;quot;B2&amp;quot;).Select    &lt;br /&gt;Selection.NumberFormat = &amp;quot;0.00%&amp;quot;&lt;/p&gt;  &lt;p&gt;Ok this is good. Basically the code is selecting cell B2 and then setting the &amp;quot;NumberFormat&amp;quot; property of the selected range to a percentage with 2 right-side decimal positions.&amp;#160; I just need to open my VSTO project and add code that gets the range for cell B2, and then sets NumberFormat property of that range to &amp;quot;0.00%&amp;quot; as follows:&lt;/p&gt;  &lt;p&gt;[C#]&lt;/p&gt;  &lt;pre class="code"&gt;Excel.&lt;span style="color: #2b91af"&gt;Range &lt;/span&gt;range1 = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Range[&lt;span style="color: #a31515"&gt;&amp;quot;B2&amp;quot;&lt;/span&gt;, missing];
range1.NumberFormat = &lt;span style="color: #a31515"&gt;&amp;quot;0.00%&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;[VB]&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;range1 &lt;span style="color: blue"&gt;As &lt;/span&gt;Excel.Range = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.Range(&lt;span style="color: #a31515"&gt;&amp;quot;B2&amp;quot;&lt;/span&gt;)
range1.NumberFormat = &lt;span style="color: #a31515"&gt;&amp;quot;0.00%&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;This assumes that you add this code to a sheet class in a document-level customization project. If you are using an application-level add-in project, you might use something like the following which formats the cell &amp;quot;B2&amp;quot; in the default sheet of the workbook.&lt;/p&gt;

&lt;p&gt;[C#]&lt;/p&gt;

&lt;pre class="code"&gt;Excel.&lt;span style="color: #2b91af"&gt;Range &lt;/span&gt;range1 = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application.get_Range(&lt;span style="color: #a31515"&gt;&amp;quot;B2&amp;quot;&lt;/span&gt;, missing);
range1.NumberFormat = &lt;span style="color: #a31515"&gt;&amp;quot;0.00%&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;[VB]&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;range1 &lt;span style="color: blue"&gt;As &lt;/span&gt;Excel.Range = Application.Range(&lt;span style="color: #a31515"&gt;&amp;quot;B2&amp;quot;&lt;/span&gt;)
range1.NumberFormat = &lt;span style="color: #a31515"&gt;&amp;quot;0.00%&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;I might have found a topic that shows me how to format a cell as a percentage, but sometimes using the macro recorder can be a lot faster.&amp;#160; Especially if the task you want to perform is something that can be done by using common Excel features. &lt;/p&gt;

&lt;p&gt;You can still search for answers in the docs. The topic &lt;a href="http://msdn.microsoft.com/en-us/library/wss56bz7.aspx"&gt;Excel Object Model Overview&lt;/a&gt; is a great place to start. There is a section in that topic named &amp;quot;Using the Excel Object Model Documentation&amp;quot; that lists several resources.&lt;/p&gt;

&lt;p&gt;Norm E.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8571844" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2003/default.aspx">Office 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2003/default.aspx">Excel 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category></item><item><title>Databinding best practices for Excel (Christin Boyd)</title><link>http://blogs.msdn.com/vsto/archive/2008/04/14/databinding-best-practices-for-excel-christin-boyd.aspx</link><pubDate>Tue, 15 Apr 2008 07:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8396399</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8396399.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8396399</wfw:commentRss><description>&lt;P&gt;I read a question on the forum about databinding in an Excel solution.&amp;nbsp; The developer was asking about Excel 2003, but the answer I wrote will work for both Excel 2003 and Excel 2007.&amp;nbsp; Here's the question:&amp;nbsp; &lt;A href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3122341&amp;amp;SiteID=1&amp;amp;mode=1" mce_href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3122341&amp;amp;SiteID=1&amp;amp;mode=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3122341&amp;amp;SiteID=1&amp;amp;mode=1&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;As a best practice you can create one dataset in ThisWorkbook designer and then programmatically reference it from your code in other sheets. &lt;/P&gt;
&lt;P&gt;Here’s how: &lt;/P&gt;
&lt;P&gt;Add new Data Source of Data Base type, by specifying a database connection and selecting tables, views and columns. &lt;/P&gt;
&lt;P&gt;Next open ThisWorkbook.vb in the designer.&amp;nbsp; It will look like it's a big gray box with two sentences that say "This is the workbook designer...."&amp;nbsp; Now from the Toolbox, under the Data section, select a DataSet and drag it onto the design surface.&amp;nbsp; When you drop it, you will get a dialog that asks if you want a typed or untyped dataset.&amp;nbsp; Select Typed.&amp;nbsp; It should prepopulate an edit box with &amp;lt;your namespace&amp;gt;.MyDataSet.&amp;nbsp; Click OK.&amp;nbsp; On the design surface you should now see an icon next to MyDataSet1.&amp;nbsp; In C# you will want to set the modifier to Internal or Public on the data set in the property browser. &lt;/P&gt;
&lt;P&gt;Next open the code behind ThisWorkbook.vb.&amp;nbsp; Inside the ThisWorkbook_Startup&amp;nbsp; procedure, you should fill your MyDataSet1 instance with code like this: &lt;/P&gt;
&lt;P&gt;VB Sample &lt;/P&gt;&lt;FONT face="courier new"&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;patientAdapter &lt;FONT color=#0000ff size=2&gt;As New&lt;/FONT&gt; MyDataSetTableAdapters.PatientsTableAdapter&lt;BR&gt;&amp;nbsp;&amp;nbsp;patientAdapter.Fill(&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;.MyDataSet1.Patients)&amp;nbsp;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt; rxAdapter &lt;FONT color=#0000ff size=2&gt;As New&lt;/FONT&gt; MyDataSetTableAdapters.PrescriptionsTableAdapter&lt;BR&gt;&amp;nbsp;&amp;nbsp;rxAdapter.Fill(&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;.MyDataSet1.Prescriptions) &lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;C# sample &lt;/P&gt;&lt;FONT face="courier new"&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;MyDataSetTableAdapters.PatientsTableAdapter ta = &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt; MyDataSetTableAdapters.PatientsTableAdapter();&lt;BR&gt;&amp;nbsp;&amp;nbsp;ta.Fill(myDataSet1.Patients);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Next you can open Sheet1 designer.&amp;nbsp; Now select "Add New Data Source" from the data menu and this time choose to add an "Object" not a database!&amp;nbsp; You will get a dialog that shows the hierarchy and this time DO NOT select the table adapter!&amp;nbsp; Open the name of your project, then the namespace, then you should see MyDataSet. Select it then click OK.&amp;nbsp; This action will create an Object in your Data Sources window. &lt;/P&gt;
&lt;P&gt;Now you can select from the Data Sources Window, you should see something called MyDataSet.&amp;nbsp; This object can be used to create a databinding in your sheets.&amp;nbsp; So you can drag from this universal object into any one of your sheets.&amp;nbsp; Grab it and drag it onto Excel Sheet1 and it created an empty table. In order to finish setting it up, select the table and in the property grid click on the arrow next to DataMember property and select the data table that you want to be bound to the table. Try it, and see how it creates a new BindingSource object for each sheet, but you still have just the one DataSet instance.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;In each Sheet, you need to add the following line of code for Each table: &lt;/P&gt;&lt;FONT face="courier new"&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;.PatientsDataTableBindingSource.DataSource = Globals.ThisWorkbook.MyDataSet1 &lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;Please let me know through comments on this blog if this explanation works for you.&amp;nbsp; Thank you!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8396399" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Christin+Boyd/default.aspx">Christin Boyd</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Data/default.aspx">Data</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2003/default.aspx">Excel 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/TableAdapter/default.aspx">TableAdapter</category><category domain="http://blogs.msdn.com/vsto/archive/tags/DataSet/default.aspx">DataSet</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Visual Studio Command Bar for Arranging Controls on Documents and Worksheets (McLean Schofield)</title><link>http://blogs.msdn.com/vsto/archive/2008/04/10/visual-studio-command-bar-for-arranging-controls-on-documents-and-worksheets.aspx</link><pubDate>Fri, 11 Apr 2008 00:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8376521</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8376521.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8376521</wfw:commentRss><description>&lt;P&gt;One of the lesser-known features of Visual Studio Tools for Office is the &lt;STRONG&gt;Microsoft Office Word&lt;/STRONG&gt; and &lt;STRONG&gt;Microsoft Office Excel&lt;/STRONG&gt; command bar. When you are developing a document-level project for Word or Excel (for example, a Word Document or Excel Workbook project) and you have the document or one of your worksheets open in the designer, this command bar appears in Visual Studio, just above the designer. In Excel, this command bar looks like the following by default. 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_10.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_10.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=168 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_1.png" width=497 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_1.png"&gt;&lt;/A&gt;&amp;nbsp; 
&lt;P&gt;The first several buttons in this command bar are for changing the keyboard scheme and mapping XML to the document or worksheet. This post is about the purpose of the rest of the buttons. 
&lt;P&gt;If you are designing a custom UI for your document or worksheet that includes Windows Forms controls that you add by using the designer, you can use these buttons to arrange the controls with a single click. When you select multiple controls in the designer, these buttons become enabled. 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image16.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image16.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=37 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image16_thumb.png" width=263 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image16_thumb.png"&gt;&lt;/A&gt;&amp;nbsp; 
&lt;P&gt;From left to right, here are the buttons you can use: 
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Lefts&lt;/STRONG&gt;. This button moves all of the controls to the left, so that they are aligned with the left side of the left-most control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Centers&lt;/STRONG&gt;. This button moves all of the controls left or right so that they are aligned around the vertical axis of the widest control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Rights&lt;/STRONG&gt;. This button moves all of the controls to the right, so that they are aligned with the right side of the right-most control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Tops&lt;/STRONG&gt;. This button moves all of the controls up, so that they are aligned with the top side of the upper-most control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Middles&lt;/STRONG&gt;. This button moves all of the controls up or down, so that they are aligned around the horizontal axis of the tallest control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Bottoms&lt;/STRONG&gt;. This button moves all of the controls down, so that they are aligned with the bottom side of the bottom-most control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Make Horizontal Spacing Equal&lt;/STRONG&gt;. The left-most and right-most control remain in place; the controls in between move horizontally so that there is equal horizontal space between each control.&lt;/P&gt;
&lt;LI&gt;&lt;STRONG&gt;Make Vertical Spacing Equal&lt;/STRONG&gt;. The top-most and bottom-most control remain in place; the controls in between move vertically so that there is equal vertical space between each control.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;A special note about Word.&lt;/STRONG&gt; In Word projects, the alignment buttons are enabled only if the selected controls are &lt;EM&gt;not&lt;/EM&gt; in line with text. By default, controls that you add to a Word document at design time are in line with text. To change the layout style of the control, right-click the control and then click &lt;STRONG&gt;Format Control&lt;/STRONG&gt;. Then, on the &lt;STRONG&gt;Layout&lt;/STRONG&gt; tab, select a wrapping style other than &lt;STRONG&gt;In line with text&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image55.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image55.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=202 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image55_thumb.png" width=461 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image55_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Examples.&lt;/STRONG&gt; Enough words! Here are some examples that show these alignment options in action. These examples are pretty contrived, but they should give you an idea of the effects of each option.&lt;/P&gt;
&lt;P&gt;Given the following buttons on a worksheet:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image19.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image19.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=232 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image19_thumb.png" width=384 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image19_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Align Lefts&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_16.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_16.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_7.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_7.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Align Centers&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_18.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_18.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_8.png" width=238 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_8.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;And &lt;STRONG&gt;Align Rights&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_20.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_20.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_9.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_9.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Given the following buttons on a worksheet:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image40.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image40.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=221 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image40_thumb.png" width=398 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image40_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Align Tops&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image43.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image43.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=116 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image43_thumb.png" width=400 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image43_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Align Middles&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image37.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image37.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=136 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image37_thumb.png" width=406 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image37_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;And &lt;STRONG&gt;Align Bottoms&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image46.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image46.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=134 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image46_thumb.png" width=400 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image46_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Given the following buttons on a worksheet:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image49.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image49.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=56 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image49_thumb.png" width=566 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image49_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Make Horizontal Spacing Equal&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image52.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image52.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=54 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image52_thumb.png" width=576 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image52_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Finally, given the following buttons on a worksheet:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image64.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image64.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=306 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image64_thumb.png" width=173 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image64_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Make Vertical Spacing Equal&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image67.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image67.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=297 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image67_thumb.png" width=186 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image67_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope these options come in handy then next time you are adding controls to a document or worksheet in VSTO.&lt;/P&gt;
&lt;P&gt;-------------------------------------------------&lt;/P&gt;
&lt;P&gt;McLean Schofield, Programming Writer&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8376521" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Command+bars/default.aspx">Command bars</category><category domain="http://blogs.msdn.com/vsto/archive/tags/McLean+Schofield/default.aspx">McLean Schofield</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2003/default.aspx">Excel 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2003/default.aspx">Word 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category></item></channel></rss>