<?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>The Ken Puls Blog &#187; Office 2007</title>
	<atom:link href="http://www.excelguru.ca/blog/category/office-2007/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.excelguru.ca/blog</link>
	<description>More geeky stuff from the author of www.excelguru.ca...</description>
	<lastBuildDate>Fri, 03 Sep 2010 04:49:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Macro to wrap an existing formula with IFERROR</title>
		<link>http://www.excelguru.ca/blog/2010/08/27/macro-to-wrap-an-existing-formula-with-iferror/</link>
		<comments>http://www.excelguru.ca/blog/2010/08/27/macro-to-wrap-an-existing-formula-with-iferror/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 21:17:34 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Office 2007]]></category>
		<category><![CDATA[Office 2010]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2010/08/27/macro-to-wrap-an-existing-formula-with-iferror/</guid>
		<description><![CDATA[Today I realized that one of my GETPIVOTDATA formulas was returning an error, since there wasn&#8217;t any result in the Pivot Table it was checking for data.  Unfortunately, during the design of the spreadsheet I never wrapped the function with IFERROR to avoid this.

The challenge I had was that I had several different formulas [...]]]></description>
			<content:encoded><![CDATA[<p>Today I realized that one of my GETPIVOTDATA formulas was returning an error, since there wasn&#8217;t any result in the Pivot Table it was checking for data.  Unfortunately, during the design of the spreadsheet I never wrapped the function with IFERROR to avoid this.
</p>
<p>The challenge I had was that I had several different formulas that needed to be wrapped, and didn&#8217;t want to spend the time adjusting each one manually.  So I wrote a little macro to adjust the existing formulas.   Basically what this does it checks each cell in the selection and, if it has a formula in it, wraps it within the following construct:  <strong>=IFERROR(<em>existing formula</em>, 0)</strong>  The point?  Now if an error is returned, it will return 0 instead.
</p>
<p>Public Sub WrapWithIfError()
</p>
<p>    Dim cl As Range
</p>
<p>
 </p>
<p>    For Each cl In Selection
</p>
<p>        If cl.HasFormula Then _
</p>
<p>           cl.Formula = &#8220;=IFERROR(&#8221; &amp; Right(cl.Formula, Len(cl.Formula) &#8211; 1) &amp; &#8220;,0)&#8221;
</p>
<p>    Next cl
</p>
<p>End Sub
</p>
<p>Just a heads up here though… you&#8217;ll need Excel 2007 or later to make use of the IFERROR function.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2010/08/27/macro-to-wrap-an-existing-formula-with-iferror/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Using getSize with RibbonX buttons</title>
		<link>http://www.excelguru.ca/blog/2009/08/04/using-getsize-with-ribbonx-buttons/</link>
		<comments>http://www.excelguru.ca/blog/2009/08/04/using-getsize-with-ribbonx-buttons/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 04:58:34 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/08/04/using-getsize-with-ribbonx-buttons/</guid>
		<description><![CDATA[A friend just asked for some help with making a getSize callback work with some buttons.  I figured this should be an easy one, and dove into the RibbonX book to check the table on page 172.  Aha!  There it is in the middle of the table:



Static Attribute
Dynamic Attribute
Allowed Values
Default Value
VBA Callback [...]]]></description>
			<content:encoded><![CDATA[<p>A friend just asked for some help with making a getSize callback work with some buttons.  I figured this should be an easy one, and dove into the RibbonX book to check the table on page 172.  Aha!  There it is in the middle of the table:</p>
<div style="margin-left: 30pt">
<table border="0" style="border-collapse: collapse">
<tr style="background: #4f81bd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
<td style="border-top: 1pt solid #4f81bd; border-left: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>Static Attribute</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>Dynamic Attribute</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>Allowed Values</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>Default Value</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>VBA Callback Signature For Dynamic Attribute</strong></span></td>
</tr>
<tr>
<td style="border-top: medium none; border-left: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><strong>size</strong></td>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">getSize</td>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">normal, large</td>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">normal</td>
<td style="border-top: medium none; border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">Sub GetSize (Control as IRibbonControl, ByRef returnedVal</td>
</tr>
</table>
</div>
<p>So I whipped up a quick example to prove it out and… wtf?  I started getting an error message:</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/08/080509_0458_UsinggetSiz1.png" /></p>
<p>Interesting… it returned a value that could not be converted to the expected type.  What the heck is that about?</p>
<p>When you set up your XML code, you use normal or large in the code.  So far as I know, they are the only allowed values, although I can&#8217;t say I tested that.  What I did test, however is both normal and large in VBA callbacks.  Both return the error listed above.</p>
<p>Interestingly enough, I decided to try passing a value of 0 or 1 to the callback via VBA and it worked!  So then I gave it a whirl with true and false.  Likewise, it worked.</p>
<p>So it looks like, in order to use a getSize callback with a button, you actually need to pass one of the following to the callback:</p>
<div style="margin-left: 30pt">
<table border="0" style="border-collapse: collapse">
<tr style="background: #4f81bd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
<td style="border-top: 1pt solid #4f81bd; border-left: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px" rowspan="2"><span style="color: white"><strong>For</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-right: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px" colspan="2">
<p style="text-align: center"><span style="color: white"><strong>Use</strong></span></p>
</td>
</tr>
<tr>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">Either</p>
</td>
<td style="border-top: medium none; border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">Or</p>
</td>
</tr>
<tr>
<td style="border-left: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><strong>normal</strong></td>
<td style="border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">0</p>
</td>
<td style="border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">False</p>
</td>
</tr>
<tr>
<td style="border-top: medium none; border-left: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><strong>large</strong></td>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">1</p>
</td>
<td style="border-top: medium none; border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">True</p>
</td>
</tr>
</table>
</div>
<p>Just in case anyone wants to have a play with this, I&#8217;ve also attached a workbook here: <a id="p362" href="http://www.excelguru.ca/blog/wp-content/uploads/2009/08/getsize.zip">getsize.zip</a>.  It also shows how to use getLabel on a tab, as well as getImage on a button.  (It&#8217;s in a zip file, so you&#8217;ll need to unzip it first as my blog won&#8217;t accept xlsm uploads.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/08/04/using-getsize-with-ribbonx-buttons/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PED 2nd Edition – Hello World!</title>
		<link>http://www.excelguru.ca/blog/2009/07/07/ped-2nd-edition-%e2%80%93-hello-world/</link>
		<comments>http://www.excelguru.ca/blog/2009/07/07/ped-2nd-edition-%e2%80%93-hello-world/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 04:07:21 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Office 2007]]></category>
		<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/07/07/ped-2nd-edition-%e2%80%93-hello-world/</guid>
		<description><![CDATA[As I mentioned in this post, I started working my way through the .NET Hello World example in PED 2nd Edition.  I ran into a funny issue though, where it kept opening up my application in Excel 2003 instead of 2007.  I fired off a quick email to Dennis who was kind enough [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned in <a href="http://www.excelguru.ca/blog/2009/06/29/vba-ide-vs-vs2008-ide/">this post</a>, I started working my way through the .NET Hello World example in <a href="http://www.amazon.com/gp/product/0321508793?ie=UTF8&#038;tag=excelguruca-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0321508793">PED 2nd Edition</a>.  I ran into a funny issue though, where it kept opening up my application in Excel 2003 instead of 2007.  I fired off a quick email to Dennis who was kind enough to give me some pointers.</p>
<p>As it turns out, my &#8220;Current Version&#8221; of Excel on my laptop was set to 11 (Excel 2003).  My attempts at running Office 2007&#8217;s Detect and Repair feature, to reset this to 12, were causing the Microsoft Bootstrapper to crash.  (So it wasn&#8217;t completing.)</p>
<p>Today I decided to install Acronis TrueImage to take a backup before I mucked with this any further and, lo and behold, it pointed out that it couldn&#8217;t install until it killed the suspended install of Office 2007.  I gave it the assent to kill the job, and then my Detect and Repair ran fine.  I&#8217;m now back up to Excel.12 as my current version, and my &#8220;Hello World&#8221; application works nicely.</p>
<p>I&#8217;m only about ½ a chapter into PED 2<sup>nd</sup> edition, but the .NET stuff is working for me so far.  I&#8217;m looking forward to digging a little deeper into this now, and trying my hand at a full managed COM Add-in.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/07/07/ped-2nd-edition-%e2%80%93-hello-world/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Debugging RibbonX Invalidate/InvalidateControl failures…</title>
		<link>http://www.excelguru.ca/blog/2009/06/17/debugging-ribbonx-invalidateinvalidatecontrol-failures%e2%80%a6/</link>
		<comments>http://www.excelguru.ca/blog/2009/06/17/debugging-ribbonx-invalidateinvalidatecontrol-failures%e2%80%a6/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 16:42:57 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Office 2007]]></category>
		<category><![CDATA[The Ribbon]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/06/17/debugging-ribbonx-invalidateinvalidatecontrol-failures%e2%80%a6/</guid>
		<description><![CDATA[I ran into this the other day when I was working on a file and it drove me nuts.
Background:
I always use a custom property to contain my RibbonUI object.  It&#8217;s set up like this:
The following code goes in the ThisWorkbook class module:
Private pRibbonUI As IRibbonUI

Public Property Let ribbonUI(iRib As IRibbonUI)
&#8216;Set RibbonUI to property for [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into this the other day when I was working on a file and it drove me nuts.</p>
<h2>Background:</h2>
<p>I always use a custom property to contain my RibbonUI object.  It&#8217;s set up like this:</p>
<p>The following code goes in the ThisWorkbook class module:</p>
<p style="margin-left: 36pt"><span style="font-family: Courier New; font-size: 12pt">Private pRibbonUI As IRibbonUI<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-family: Courier New; font-size: 12pt">Public Property Let ribbonUI<strong>(</strong>iRib As IRibbonUI<strong>)</strong><br />
&#8216;Set RibbonUI to property for later use<br />
Set pRibbonUI = iRib<br />
End Property<br />
</span></p>
<p style="margin-left: 36pt"><span style="font-family: Courier New; font-size: 12pt">Public Property Get ribbonUI<strong>()</strong> As IRibbonUI<br />
&#8216;Retrieve RibbonUI from property for use<br />
Set ribbonUI = pRibbonUI<br />
End Property<br />
</span></p>
<p>And then the onLoad statement, placed in a standard module, looks like this:</p>
<p style="margin-left: 36pt"><span style="font-family: Courier New; font-size: 12pt">Private Sub rxIRibbonUI_OnLoad(ribbon As IRibbonUI)<br />
&#8216;Set the RibbonUI to a workbook property for later use<br />
ThisWorkbook.ribbonUI = ribbon<br />
End Sub<br />
</span></p>
<p>At that point I can invalidate the entire ribbon by using:</p>
<p style="margin-left: 36pt"><span style="font-family: Courier New; font-size: 12pt">ThisWorkbook.ribbonUI.Invalidate</span></p>
<p>Or just a single control:</p>
<p style="margin-left: 36pt"><span style="font-family: Courier New; font-size: 12pt">ThisWorkbook.ribbonUI.InvalidateControl &#8220;ControlName&#8221;<br />
</span></p>
<h2>The Issue:</h2>
<p>This particular problem started for me when my InvalidateControl methods weren&#8217;t working.  This was irritating, but I&#8217;ve debugged a lot of RibbonX before, so I thought it may be the control name.  After checking the XML I was pretty sure it wasn&#8217;t, but just for grins I switched to try to Invalidate the entire ribbon.  That didn&#8217;t work either…</p>
<p>Next up on the debugging mission was to step through the code, at which point I discovered that I had no reference to the RibbonUI object.  As you&#8217;ve no doubt figured out if you worked with the ribbon, you can&#8217;t invalidate your controls without a RibbonUI object to work with.  So somewhere I thought I must be triggering an error which caused the RibbonUI to lose scope.  Despite a ton of searching through the VBA though, I couldn&#8217;t find anything that would trigger this kind of error.</p>
<p>Given that my code all looked good, I added a single line into my OnLoad statement so that it read as follows:</p>
<p style="margin-left: 36pt"><span style="font-family: Courier New; font-size: 12pt">Private Sub rxIRibbonUI_OnLoad(ribbon As IRibbonUI)<br />
&#8216;Set the RibbonUI to a workbook property for later use<br />
Debug.Print &#8220;Fired!&#8221;<br />
ThisWorkbook.ribbonUI = ribbon<br />
End Sub</span></p>
<p>I then opened the file again, and found no message in the immediate window.  Hmmm…  The callback was obviously never called at all.  This is a little strange, as this callback should be triggered as soon as the file was opened.  So then I checked the remaining things that could cause these kind of issues:</p>
<ul>
<li>
<div>I checked the Trust Center to ensure that:</div>
<ul>
<li>macros were set to &#8220;Disable With Notification&#8221;</li>
<li>The folder where the file was stored (on my network) was a Trusted Location (and that subfolders were also trusted)</li>
</ul>
</li>
<li>I checked that the onLoad callback matched that generated by the customUI Editor</li>
<li>
<div>I check that UI errors would be displayed (just in case my XML wasn&#8217;t valid).   You can find this under Office<span style="font-family: Wingdings">à</span>Excel Options<span style="font-family: Wingdings">à</span>Advanced near the bottom of the list:</div>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/06/061709_1642_DebuggingRi1.png" /></li>
</ul>
<p>None of these earned me any joy though.  Things still didn&#8217;t work.  I then emailed the files to a friend and guess what… they worked!</p>
<p>With the problem isolated to my machine, I then disabled all my other add-ins and opened Excel fresh.  Lo and behold, it worked!</p>
<h2>The Fix:</h2>
<p>When we wrote the RibbonX book, Robert and I standardized on naming the onLoad callback <em><span style="font-family: Courier New; font-size: 12pt">rxIRibbonUI_OnLoad</span>.</em>  I&#8217;m starting to rethink that advice a bit…</p>
<p>In my case, I had two add-ins with this same onLoad name, one of which had the onLoad callback declared as a Public routine, rather than private.  This caused a conflict when I wrote a new add-in and used the exact same procedure/callback name.  Just to make this clear:</p>
<p style="margin-left: 36pt">Add-in #1 used:    <strong>Public</strong> Sub rxIRibbonUI_onLoad(ribbon as IRibbonUI)</p>
<p style="margin-left: 36pt">Add-in #2 used:    <strong>Private</strong> Sub rxIRibbonUI_onLoad(ribbon as IRibbonUI)</p>
<p style="margin-left: 36pt">Even though Add-in #2&#8217;s onLoad was correctly written, at load time it did not run.  I didn&#8217;t actually test this to be totally sure, but I&#8217;m 99.9% confident that Add-in #1&#8217;s onLoad DID fire instead.</p>
<p>So some suggested rules for you if you&#8217;re building an add-in:</p>
<ul>
<li>Code to avoid conflicts.  Even if you are only writing one add-in, you never know if you&#8217;ll end up installing one from somewhere else.  If both you and the other author followed our naming convention, and the other author screwed up their callback by declaring it as Public, YOUR add-in will not run correctly.  (Nice, eh?)</li>
<li>Declare (ALL) your RibbonX callbacks as Private.  This will avoid pushing this issue on someone else.  By default, the customUI editor authors its callbacks as Sub blahblah().  Omitting the Private keyword by default leaves it as Public.</li>
<li>Forget about Option Private Module.  If you think you can use Public callbacks and just declare the module private with &#8220;Option Private Module&#8221;, see rule #2.  (Trust me.  That one I did test, and is what led to this whole mess.)</li>
<li>Add a project specific name to the end of the callback.  E.g. &#8220;<strong>rxIRibbonUI_onLoad_FWBudgetTools</strong>&#8220;.  While I still believe in standards, you need to tag it with differentiating text to avoid conflicts with other add-ins.  Oh sure, it may look long and unwieldy but let&#8217;s face it &#8212; you&#8217;re only going to write this routine once per project and forget all about it after that!</li>
</ul>
<p><sub><br />
</sub></p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/06/17/debugging-ribbonx-invalidateinvalidatecontrol-failures%e2%80%a6/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Trigger Conditional Formats Before Printing</title>
		<link>http://www.excelguru.ca/blog/2009/05/11/trigger-conditional-formats-before-printing/</link>
		<comments>http://www.excelguru.ca/blog/2009/05/11/trigger-conditional-formats-before-printing/#comments</comments>
		<pubDate>Tue, 12 May 2009 04:48:10 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/05/11/trigger-conditional-formats-before-printing/</guid>
		<description><![CDATA[A little background
My staff and spreadsheet users will tell you that any time I build a spreadsheet, there are always shaded cells on the grid.  I preach that "Green means go", and make sure that any cell they enter data in has a green background.  I also use blue backgrounds for "update these [...]]]></description>
			<content:encoded><![CDATA[<h2>A little background</h2>
<p>My staff and spreadsheet users will tell you that any time I build a spreadsheet, there are always shaded cells on the grid.  I preach that "Green means go", and make sure that any cell they enter data in has a green background.  I also use blue backgrounds for "update these sometimes" cells, like tax rates.  If cells are left with no colouring, though… everyone here knows that they should be left alone.</p>
<p>The case I was working on today was a development report, of which I have a few data entry cells scattered throughout the overall file.  You could argue that this violates a good design principle in that you should keep the data separate from the report, but in this case I'm comfortable with the design.  I have shaded my input cells in green, and know that I'm not going to lose track of them.</p>
<p>The problem that I decided to address today was that the green backgrounds print.  While they're great for telling the user where to input data manually, our Asset Manager isn't really interested in seeing that kind of info.  In fact, it's distracting, so better left off.  But how do you do that?</p>
<p>I could create a full new report that essentially duplicates what I've got, but then it's both a maintenance headache and performance hit.  Not really where I want to go.  Instead, I opted to use a conditional format to hide the colour on the cells when I go to print the sheet.  This would have been really easy, if it weren't for the fact that I wanted to do it automatically.  That involved dipping into some VBA.  If you're not comfortable working with VBA though, read on anyway.  You can still do the setup for this and control it manually.</p>
<p>I'll get into the steps I used to solve the issue in just a sec, but I wanted to say that, to me, this article illustrates three things:</p>
<ul>
<li>If you aren't aware of conditional formatting, you should be</li>
<li>If you don't know VBA, you should learn it</li>
<li>There should be a Workbook_AfterPrint event in VBA</li>
</ul>
<h2>Step 1 – Setting up the Control Point</h2>
<p>The first thing I decided to do was to create a cell to control what mode I'm in.  i.e. Printing Mode or Working mode.  There's lots of ways I could have done this, but since I have a worksheet dedicated to being a "Control Panel", I set it a cell on that worksheet to hold a "Yes" or "No" value:</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/05/051209_0448_TriggerCond1.png" /></p>
<p>As you can see, I use this approach to drive a few other things as well, such as dates for column headers, the type of data pulled from a PivotTable and more.)</p>
<p>Before someone asks why not True/False values, I opted to use Yes/No as it's more readable to others if they have to work with the spreadsheet.</p>
<h2>Step 2 – Name the Range</h2>
<p>The next thing I did is assign a name to the PrintMode value.  In this case, I assigned the name <strong>rngPrintMode</strong> to the cell B11 on my control panel worksheet.  While this isn't truly required to make this work, I just find it much easier to work with the named range later, rather than try to remember the cell reference.  It does become key when you move to the VBA side though.  VBA doesn't update its reference to the cell when a line in inserted above, while the name range does.  For this reason, I always used named ranges when referring to worksheet ranges in VBA.</p>
<h2>Step 3 – Set up the Conditional Format</h2>
<p>The steps shown below are for Excel 2007, but with a little ingenuity, I believe you could make this work in 2003.  I'm assuming that you already have a green (or other) background on your data entry cell at this point.</p>
<ol>
<li>Select the data entry cell(s) that you want to hide the colour on</li>
<li>
<div>On the Home Tab<span style="font-family: Wingdings">à</span>Conditional Formatting<span style="font-family: Wingdings">à</span>New Rule then create a formula as shown below:</div>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/05/051209_0448_TriggerCond2.png" /></li>
<li>Click Format</li>
<li>From the "Fill" tab, click "No Color"</li>
<li>Click OK twice</li>
</ol>
<p>At this point, the conditional format has been set up.  As an optional step, I actually also set the "Stop If True" option in 2007, as this allows me to use multiple conditional formats on the same section, yet ignore them all for printing.  You won't find this in Excel 2003 though.  (Also, if you want to stop all formats, make sure the rule is at the top of the list!)</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/05/051209_0448_TriggerCond3.png" /></p>
<p>As far as the setting up the conditional formatting, you're actually done.  Change the value on the rngPrintMode cell to "Yes", and your conditional formats should kick in, removing any applied background colours.  Now you can print without the data entry cells conspicuously marked!  Change it back to "No", and the colours re-appear.</p>
<p>Just a hint here… if you want to leave this as a manual control, I'd suggest setting up a data validation list to control the field.  Debra Dalgleish has a great article on doing that <a href="http://www.contextures.com/xlDataVal01.html">which you can find right here</a>.</p>
<h2>Step 4 – Adding Automation</h2>
<p>Personally, I don't do manual if I can help it.  Maybe I'm pretty lazy, but I want this to automatically kick in when I hit print, and set itself back once it's done.  So to do this, I added a couple of procedures to my project.</p>
<p>In a <strong>STANDARD MODULE</strong>, I added the following:</p>
<div class="igBar"><span id="lvb-3"><a href="#" onclick="javascript:showPlainTxt('vb-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-3">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Public</span> <span style="color: #b1b100;">Sub</span> PrintingActive<span style="color:#006600; font-weight:bold;">&#40;</span>Optional bStatus = <span style="color: #b1b100;">False</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'Date Created : 5/11/2009 10:48</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'Author       : Ken Puls (www.excelguru.ca)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'Macro Purpose: Toggle the printing mode variable to control</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'               conditional format set</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Dim</span> rngInfo <span style="color: #b1b100;">as</span> Range</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'!!! Set Your Worksheet Here !!!</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Set</span> rngInfo = Worksheets<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"Control Panel"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">Range</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"rngPrintMode"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'Check the status and set the cell accordingly</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">If</span> bStatus = <span style="color: #b1b100;">True</span> <span style="color: #b1b100;">Then</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rngInfo.<span style="color: #66cc66;">Value</span> = <span style="color: #ff0000;">"Yes"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rngInfo.<span style="color: #66cc66;">Value</span> = <span style="color: #ff0000;">"No"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
You'll need to change your worksheet name for the one that holds the named range you defined earlier.  Just change "Control Panel" to "Your Worksheet Name".</p>
<p>Then, I went to the <strong>THISWORKBOOK</strong> module, and put the following in it:</p>
<div class="igBar"><span id="lvb-4"><a href="#" onclick="javascript:showPlainTxt('vb-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-4">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Private</span> <span style="color: #b1b100;">Sub</span> Workbook_BeforePrint<span style="color:#006600; font-weight:bold;">&#40;</span>Cancel <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Boolean</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'Date Created : 5/11/2009 10:34</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'Author       : Ken Puls (www.excelguru.ca)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080;">'Macro Purpose: Toggle the conditional formats for printing</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Call</span> PrintingActive<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #b1b100;">True</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Application.<span style="color: #66cc66;">OnTime</span> <span style="color: #b1b100;">Now</span> + <span style="color: #b1b100;">TimeValue</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"00:00:01"</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color: #ff0000;">"PrintingActive"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
At this point, providing you had things working manually in step 3, things should just work by hitting the print button.  The BeforePrint routine will call the PrintingActive routine, which will flip the rngPrintMode variable to TRUE.  This will in turn trigger the conditional format rule.  The Application.OnTime then schedules a call of the PrintingActive routine to run in one second.  The worksheet(s) are then printed.</p>
<p>The part that bugs me about this approach is that I have to rely on using OnTime, which kicks off a routine based on time, not necessarily when my existing routine completes.  Theoretically, if I had a really huge print job, the call to PrintingActive could be triggered before my job is complete.  In my tests that didn't happen, but if it does, just add a few seconds to the TimeValue.  I.e. "00:00:15" will turn it into a 15 second delay.</p>
<p>The ideal solution would have been to leverage a Workbook_AfterPrint event, but sadly one does not exist.</p>
<h2>Conclusion</h2>
<p>For my needs, this works.  I now just click the print button and all of my green cells change their backgrounds to white (transparent), the file prints, and then the colour(s) are reintstated.  And it all happens without me having the change the cell value manually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/05/11/trigger-conditional-formats-before-printing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Making an Icon Set show only two conditions</title>
		<link>http://www.excelguru.ca/blog/2009/04/23/making-an-icon-set-show-only-two-conditions/</link>
		<comments>http://www.excelguru.ca/blog/2009/04/23/making-an-icon-set-show-only-two-conditions/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 05:17:32 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/04/23/making-an-icon-set-show-only-two-conditions/</guid>
		<description><![CDATA[I really like the new icon sets that are in Excel 2007.  They're kind of a neat way to format a cell to show interpretive information at a glance.

One practical place to use these is as an alternative to the using custom number formats that I blogged about last year.  I decided to [...]]]></description>
			<content:encoded><![CDATA[<p>I really like the new icon sets that are in Excel 2007.  They're kind of a neat way to format a cell to show interpretive information at a glance.
</p>
<p>One practical place to use these is as an alternative to the using custom number formats that I <a href="http://www.excelguru.ca/blog/2008/06/04/custom-number-formats/">blogged about last year</a>.  I decided to use Excel's icon sets to show a green check when something was positive and a red x when negative, as shown below:
</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042409_0517_MakinganIco1.png" alt=""/>
	</p>
<p>One thing that can be frustrating when trying to set this up is that Excel forces you to use the three part icon set.  By default, the image above would have a yellow exclamation beside the zero.  Personally, I don't need it.  But with Excel forcing it on you, how do you avoid it?  Here's how I did it:
</p>
<ul>
<li>
<div>Select the cells:
</div>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042409_0517_MakinganIco2.png" alt=""/>
			</p>
</li>
<li>
<div>From the Home tab, choose Conditional Formatting<span style="font-family:Wingdings">à</span>Icon Sets<span style="font-family:Wingdings">à</span> More Rules
</div>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042409_0517_MakinganIco3.png" alt=""/>
			</p>
</li>
<li>
<div>Using the default of "Format All Cells Based On Their Values", set up the rule as follows:
</div>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042409_0517_MakinganIco4.png" alt=""/>
			</p>
</li>
<li>
<div>You'll need to change:
</div>
<ul>
<li>The "Type" fields to "Number"
</li>
<li>The Icon Style
</li>
</ul>
</li>
<li>Apply the rule
</li>
</ul>
<p>Now you have the cells looking as shown below, but how do you hide the yellow exclamation on the zero?
</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042409_0517_MakinganIco5.png" alt=""/>
	</p>
<p>The answer is to set up a conditional format using another of Excel 2007's conditional format tools; Stop if True
</p>
<ul>
<li>Select the cells again
</li>
<li>This time choose "New Rule" from the Conditional Formatting menu (not "More Rules" from the icon set area)
</li>
<li>
<div>Choose to "Format only cells that contain" and set up the rule as shown below:
</div>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042409_0517_MakinganIco6.png" alt=""/>
			</p>
</li>
</ul>
<p>Applying the rule now won't have any effect, as it is essentially a blank rule.  (See the message about "No Format Set"?)
</p>
<ul>
<li>Click Format
</li>
<li>On the "Fill" tab, click "No Color" for the background and click OK twice
</li>
</ul>
<p>We now have our second rule set up, but nothing appears different.  Let's fix that:
</p>
<ul>
<li>With the cells still selected, go back and choose "Manage Rules" from the Conditional Formatting menu
</li>
<li>
<div>Check the "Stop if True" box beside your latest rule as shown:
</div>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042409_0517_MakinganIco7.png" alt=""/>
			</p>
</li>
</ul>
<p>Click Apply and it should the yellow exclamation disappears from the scenario.
</p>
<p>The "Stop if True" feature is a great addition to Excel's conditional formatting as it allows us to decide just how many of our formats we wish to overlay in 2007.  Depending on how many you apply to one cell though, you may have issues with trying to figure out inheritance issues, so use them carefully.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/04/23/making-an-icon-set-show-only-two-conditions/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Actual Charts vs Images</title>
		<link>http://www.excelguru.ca/blog/2009/04/20/actual-charts-vs-images/</link>
		<comments>http://www.excelguru.ca/blog/2009/04/20/actual-charts-vs-images/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 03:42:56 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/04/20/actual-charts-vs-images/</guid>
		<description><![CDATA[In a blog post last week, I was looking at the image formats to use when I snapped a picture of a chart.  I'm kind of glad that Jon agreed with my assessment on EMF being the best image format for this, as it at least means I might be on the right track.

Jon [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://www.excelguru.ca/blog/2009/04/15/best-picture-format-for-scaled-charts/">blog post last week</a>, I was looking at the image formats to use when I snapped a picture of a chart.  I'm kind of glad that Jon agreed with my assessment on EMF being the best image format for this, as it at least means I might be on the right track.
</p>
<p>Jon also asked a question though… "Why not just use charts".
</p>
<p>Good question, and sorry I didn't respond earlier, Jon.  I got wrapped up in the course I was teaching.  <img src='http://www.excelguru.ca/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
</p>
<h2>Main Purpose:<br />
</h2>
<p>Just to get it out there, the main purpose of me building these charts was to show them as micro charts on a dashboard.  Some inspirational dashboards I was modeling on can be found at Charely Kyd's site. <a href="http://www.exceluser.com/dash/digest/samples/pnp2-samples/Rpt01_AmandasChoice.htm">Here's just one of them</a>.
</p>
<p>Now, it's ENTIRELY possible that I'm going about this the wrong way, and am about to get schooled.  I'm totally okay with that if it's the case.  I haven't done any dash-boarding in Excel before, so this is a big experimentation for me.  With that in mind, please feel free to offer suggestions or critique.  I'm really trying to find the best mix of results and maintainability here.
</p>
<p>I think the best approach to explain why not just use charts is to look at what I did along the way…  So here's the history of why I went where I did.
</p>
<h2>Original Chart<br />
</h2>
<p>I created my original chart and got it looking exactly as I wanted.  I got the colours the way I wanted, set up my scales to work for me, and I basically got it to where I like the overall display.  What I ended up with is the chart below (shown at actual size):
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042109_0342_ActualChart1.png" alt=""/>
	</p>
<h2>Scaling Attempt 1:<br />
</h2>
<p>From there, I tried to scale the original chart down to micro chart size, and ended up with this nasty looking thing:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042109_0342_ActualChart2.png" alt=""/>
	</p>
<p>I had a quick look through all the options on the chart, but couldn't find anything that dealt with the scale preservation when shrinking.  At least, I did find the "Size" on the Chart Tools<span style="font-family:Wingdings">à</span>Format contextual tab on the ribbon, but it didn't seem to help.  I could have tried to build it smaller, I guess, but then it would be hard to read on screen to see if it looked okay.  In addition, I don't know if I could get everything to the right size.  (Font sizes of 1.5, 1.2 or lower maybe?)
</p>
<p>Basically, since the scale went all nasty, I gave up and reached toward the camera tool.
</p>
<h2>Scaling Attempt 2:<br />
</h2>
<p>I reached towards the camera tool to create snapshots of the charts.  Actually, this had another bonus in that I need to create different dashboards from the same data, so I will end up using the same chart more than once.  I figured that the camera tool would be a great solution for that, since I would only have to maintain the source chart once.
</p>
<p>But the camera tool is flaky.  About 6 different charges into the project, I ended up with all the charts suddenly turning grey, and I couldn't get them to come back.  Naturally, if you can't rely on it, you really can't use it, so I ditched it and moved on (after wasting a bunch of time trying to make it work.)
</p>
<h2>Scaling Attempt 3:<br />
</h2>
<p>This is where I opted to go with copy the chart and doing a PasteSpecial<span style="font-family:Wingdings">à</span>Picture.  Using the EMF version I got a nicely scaled micro chart:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/042109_0342_ActualChart3.png" alt=""/>
	</p>
<p>This added another benefit as well, actually, in that the dashboard page could be built on a separate sheet from the original data.  Maybe it was the way that I set it up, but this seemed difficult to do with the camera tool.  (In all fairness, I did NOT try to create a chart with source data on another sheet, but I can't see that being an issue.)
</p>
<h2>Potential/Known Issues:<br />
</h2>
<p>I'm not going to say that this is all roses, either though.  There are issues here, obviously, maintenance probably being the biggest of them.  The image is static, so I had to knock up some VBA code to remove all the existing pictures on the sheet and rebuild them.  That actually wasn't a big deal in the grand scheme of things.  And at least the charts look consistent with the originals and print well.
</p>
<p>In the process, I discovered that you can name charts in Excel 2007 through the UI.  (Whooppee, you'd expect that…)  But I also discovered that you can name multiple charts the exact same thing.  That sucks.  Once I'd set up one series of charts, I copied them all to use with my next set of stuff.  (You see Food above, but I also have about 9 other product lines to deal with.)  I figured I'd just change the source data, but I also had to be very careful to make sure I got the chart names, or I'd have some weird things happening when I referred to those names in code.  (I'm floored that we'd be able to name multiple charts on the same sheet with the same name, but there you go.)
</p>
<p>I'm also not happy with the difficultly this presents in creating the dashboard for the first time.  How do you get the code to recognize the insertion point of the picture on the sheet?  The dashboard has numeric data as well, with some (basic) conditional formatting, and the column widths are not consistent.  So how do you line up the images with the grid?  The short answer is that you can't.  So then we get into issues of how to get the image to the correct place.
</p>
<h2>Thoughts that are currently still cooking…<br />
</h2>
<p>I'm still trying to work my way through this, but I'm starting to wonder if I won't have to force consistent column widths.  If I did, I can see a couple of potential solutions to my issues:
</p>
<ul>
<li>I could then set up a table of chart names and cell references.  A little code could then retrieve the chart and place it at the coordinate of the cell specified.
</li>
<li>Rob van Gelder made <a href="http://www.dailydoseofexcel.com/archives/2006/02/05/in-cell-charting/">spark lines by creating a shape via a UDF</a>.  This might work if I could feed in the chart name as a parameter… but I think it's a non-starter.  While you seem to be able to create simple line shapes, I'm running into issues trying to create get the full chart into a (new) shape.
</li>
</ul>
<p>I think I'd actually prefer the latter, but this still kind of sucks as it would probably need consistent column widths to avoid overlapping charts.  While it would work well there, I'm not sure I want the rest of my report bound to having extra whitespace.
</p>
<p>At any rate, that's what led me into pictures from real charts.
</p>
<p>Suggestions, thoughts and comments all welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/04/20/actual-charts-vs-images/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Best picture format for scaled charts?</title>
		<link>http://www.excelguru.ca/blog/2009/04/15/best-picture-format-for-scaled-charts/</link>
		<comments>http://www.excelguru.ca/blog/2009/04/15/best-picture-format-for-scaled-charts/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 19:24:55 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/04/15/best-picture-format-for-scaled-charts/</guid>
		<description><![CDATA[*Note:*  The charts in this post are based on sample data and do not reflect any real financial performance.
In setting up my first dashboard, I took a page out of Charley Kyd's book and placed a bunch of little graphs on my report.  I tried to use the Camera tool first, but after [...]]]></description>
			<content:encoded><![CDATA[<p>*Note:*  The charts in this post are based on sample data and do not reflect any real financial performance.</p>
<p>In setting up my first dashboard, I took a page out of Charley Kyd's book and placed a bunch of little graphs on my report.  I tried to use the Camera tool first, but after I had about 7 on the page, the graphs all went to grey backgrounds, and you couldn't see anything anymore.  I could not, for the life of me, get them to revert to live images.  Very irritating.  I suspect that it has something to do with Excel 2007, but I've never used the camera tool in earnest before, so can't be sure.</p>
<p>Just to get this out of the way first, I set up a bunch of charts on a worksheet.  I ultimately wanted to show a smaller version of these charts in my dashboard. Unfortunately charts don't scale well when you try to shrink them down, or at least, mine are poorly set up to do so.  This is why I wanted to use the camera tool, as it deals with this well.</p>
<p>Since the camera tool was giving me issues, I elected to go with copying my charts and pasting them as images.  Adding a little VBA to it, I can wipe all the existing charts on the page, and re-create current chart images.  This gives me semi-live chart updates vs the live updates that would have been available if I could have made the camera tool to work for me.</p>
<p>During the process, I found that some of the Paste As Image choices scaled better than others.  Here's what I started and ended with:</p>
<table border="0" style="border-collapse: collapse">
<tr>
<td style="border: 0.5pt solid black; padding-left: 7px; padding-right: 7px"></td>
<td style="border-style: solid solid solid none; border-color: black black black -moz-use-text-color; border-width: 0.5pt 0.5pt 0.5pt medium; padding-left: 7px; padding-right: 7px">Height</td>
<td style="border-style: solid solid solid none; border-color: black black black -moz-use-text-color; border-width: 0.5pt 0.5pt 0.5pt medium; padding-left: 7px; padding-right: 7px">Width</td>
</tr>
<tr>
<td style="border-style: none solid solid; border-color: -moz-use-text-color black black; border-width: medium 0.5pt 0.5pt; padding-left: 7px; padding-right: 7px">Original</td>
<td style="border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding-left: 7px; padding-right: 7px">181.9357</td>
<td style="border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding-left: 7px; padding-right: 7px">252.5019</td>
</tr>
<tr>
<td style="border-style: none solid solid; border-color: -moz-use-text-color black black; border-width: medium 0.5pt 0.5pt; padding-left: 7px; padding-right: 7px">Resized</td>
<td style="border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding-left: 7px; padding-right: 7px">80</td>
<td style="border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding-left: 7px; padding-right: 7px">100</td>
</tr>
</table>
<p>The formats that you can paste into are Png, Jpeg, Gif, Enhanced Metafile, and Bitmap.  I tried all of them.</p>
<p>The ironic thing is that print preview makes the Enhanced Metafile look absolutely awful, as you can see here:</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/041509_1924_Bestpicture1.png" /></p>
<p>In reality though, once printed out I found that the Enhanced Metafile gave the truest representation to the original of all of the formats.  That surprised me a little, as I was kind of expecting png to be the best.  My thoughts on this, for reference:</p>
<p>Png: Looked like certain lines were "clipped".  The bottom of the number 1 characters, for example, seemed to miss part of the bottom line.</p>
<p>Jpeg:  Everything looked like it's been bolded, and there seems to be a smattering of extra pixels on the graph.  It looks just… "dirty" I guess.</p>
<p>Gif:  Numbers are blurred and clipped.  Far from professional looking</p>
<p>Bitmap:  The second best of the lot, but still looks dirty</p>
<p>The Enhanced Metafile, on the other hand, was crisp, clean and sharp.  Despite being scaled out of proportion, it still looks very good.</p>
<p>Just to prove that they do look better, here's a PDF of the printout: <a id="p331" href="http://www.excelguru.ca/blog/wp-content/uploads/2009/04/imgsample.pdf">imgsample.pdf</a></p>
<p>I'm curious to other thoughts on this, as this is the first major effort I've concentrated in this area.  If you're using pictures, does what I'm looking at hold true for you as well?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/04/15/best-picture-format-for-scaled-charts/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Resize Images in Word</title>
		<link>http://www.excelguru.ca/blog/2009/04/01/resize-images-in-word/</link>
		<comments>http://www.excelguru.ca/blog/2009/04/01/resize-images-in-word/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 04:41:54 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/04/01/resize-images-in-word/</guid>
		<description><![CDATA[I'm working on writing up a course, and it always drives me nuts when the pictures I put in the document are different shapes.  Height is fine, but I always want the width to be the same as the document looks weird with margins that change.  Resizing manually is not practical as it [...]]]></description>
			<content:encoded><![CDATA[<p>I'm working on writing up a course, and it always drives me nuts when the pictures I put in the document are different shapes.  Height is fine, but I always want the width to be the same as the document looks weird with margins that change.  Resizing manually is not practical as it takes time and eyeballing is not really reliable.
</p>
<p>So I knocked up a quick piece of code to resize all the images in my word document.  I don't claim to be a Word VBA expert, so this can probably be improved, but here it is:
</p>
<p>Sub ResizeImages()
</p>
<p>'Date Created : 4/1/2009 21:36
</p>
<p>'Author       : Ken Puls (www.excelguru.ca)
</p>
<p>'Macro Purpose: Resize an image in Word
</p>
<p>
 </p>
<p>    Dim shp As InlineShape
</p>
<p>    For Each shp In ActiveDocument.InlineShapes
</p>
<p>        shp.Width = 300
</p>
<p>    Next shp
</p>
<p>
 </p>
<p>End Sub
</p>
<p>
 </p>
<p>The size is measured in points, and 300 equates to about 4.75" on the page (at least here, anyway.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/04/01/resize-images-in-word/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weird Word to Excel conversion</title>
		<link>http://www.excelguru.ca/blog/2009/03/24/weird-word-to-excel-conversion/</link>
		<comments>http://www.excelguru.ca/blog/2009/03/24/weird-word-to-excel-conversion/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 16:54:17 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/03/24/weird-word-to-excel-conversion/</guid>
		<description><![CDATA[I seem to be tripping on some odd things with Excel lately.  I was trying to take a list of stuff from Word and turn it into a table of data when I tripped on this one.  It's a bit bizarre and a bit amusing… Try this:

Create a new Word document with the [...]]]></description>
			<content:encoded><![CDATA[<p>I seem to be tripping on some odd things with Excel lately.  I was trying to take a list of stuff from Word and turn it into a table of data when I tripped on this one.  It's a bit bizarre and a bit amusing… Try this:
</p>
<p>Create a new Word document with the following:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/03/032409_1654_WeirdWordto1.png" alt=""/>
	</p>
<p>(The bullets are important)
</p>
<p>Copy the data and paste it in Excel.  You should now get something that looks like this:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/03/032409_1654_WeirdWordto2.png" alt=""/>
	</p>
<p>Now, go into cell A1, and copy the bullet and the spaces from the formula bar:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/03/032409_1654_WeirdWordto3.png" alt=""/>
	</p>
<p>Highlight column A and choose Find/Replace.  (On the Ribbon this is on the Home Tab<span style="font-family:Wingdings">à</span>Find &amp; Select<span style="font-family:Wingdings">à</span>Replace)
</p>
<p>In the box that comes up, paste the text you just copied into the "Find" section and click "Replace All"
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/03/032409_1654_WeirdWordto4.png" alt=""/>
	</p>
<p>Here's the result:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/03/032409_1654_WeirdWordto5.png" alt=""/>
	</p>
<p>Wow!  That's kind of funky!  Yet when you click in A2, the formula bar shows the correct text:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/03/032409_1654_WeirdWordto6.png" alt=""/>
	</p>
<p>Go figure!  What happened is that the bullet character is actually in the Symbol font, but the rest of the text in the cell is in whatever your default font was in Word.  Replacing the leading text applies that font to the rest of the cell.  It was particularly frightening in my first view (on real data):
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/03/032409_1654_WeirdWordto7.png" alt=""/>
	</p>
<p>I thought I'd moved to another country!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/03/24/weird-word-to-excel-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
