<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Code For Excel And Outlook</title>
	
	<link>http://www.codeforexcelandoutlook.com</link>
	<description>Automation and VBA code for Microsoft® Excel and Outlook</description>
	<lastBuildDate>Tue, 27 Jul 2010 11:30:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CodeForExcelAndOutlook" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="codeforexcelandoutlook" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /><image><link>http://www.codeforexcelandoutlook.com/</link><url>http://s929.photobucket.com/albums/ad137/jp2112jp/xo.png</url><title>Logo</title></image><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">CodeForExcelAndOutlook</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Q2 2010 Stats</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/07/q2-2010-stats/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/07/q2-2010-stats/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 11:30:14 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Office Cafe]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1192</guid>
		<description><![CDATA[Just realized I didn't post any metrics for Q2 this year. We had the most single-day visits ever, at 1,255 on June 8th (that number has since been surpassed). This site receives 80 to 100 refers per day. Link love goes out to the following people who have linked to Code For Excel and Outlook [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/q2-2010-stats/">Q2 2010 Stats</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p>Just realized I didn't post any metrics for Q2 this year.</p>
<p><span id="more-1192"></span></p>
<p>We had the most single-day visits ever, at 1,255 on June 8th (that number has since been surpassed).</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/2010_Q2Stats.png" alt="q2 stats" title="q2 stats" /></p>
<p>This site receives 80 to 100 refers per day. Link love goes out to the following people who have linked to Code For Excel and Outlook in Q2:</p>
<ul>
<li>Chandoo from <a href="http://chandoo.org/wp">Chandoo.org</a></li>
<li>Dick from <a href="http://www.dailydoseofexcel.com/">DDoE</a></li>
<li>Mike from <a href="http://datapigtechnologies.com/blog/">DataPig Technologies</a></li>
<li>John's <a href="http://www.spreadsheetpage.com/">Spreadsheet Page</a></li>
<li>Debra at <a href="http://blog.contextures.com/">Contextures</a></li>
<li>Jon at <a href="http://peltiertech.com/WordPress">Peltier Technical Services</a></li>
</ul>
<p><strong>And many others, you are not forgotten!</strong></p>
<p>This blog was also mentioned in the <a href="http://firstlook.blogs.nytimes.com/2010/04/27/roll-call-votes-and-roulette-times-apis/">NY Times Blog</a> for my use of the <a href="http://www.codeforexcelandoutlook.com/vba/nys-legislature-api-examples/">NY Times API</a>.</p>
<p>In the next quarter (Q3) we'll be going through more APIs, as well as exploring IE browser methods for IE automation and looking at YQL, the query language for Yahoo.</p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/q2-2010-stats/">Q2 2010 Stats</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=JZmtm8V3H8M:7SiBgpQ7JFk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=JZmtm8V3H8M:7SiBgpQ7JFk:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=JZmtm8V3H8M:7SiBgpQ7JFk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/JZmtm8V3H8M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/07/q2-2010-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zip outgoing attachments</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/07/zip-outgoing-attachments/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/07/zip-outgoing-attachments/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 11:00:21 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Outlook]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[attachments]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1191</guid>
		<description><![CDATA[Edouard asks for some code that will automatically archive attachments on outgoing emails. Let's start with the code found at Saving Compressed Attachments and go from there. We'll also need some help from Ron de Bruin and his code to zip files using VBA. The Application_ItemSend Event This Application-level event fires whenever any item is [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/zip-outgoing-attachments/">Zip outgoing attachments</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/squeeze.png" alt="squeeze" title="squeeze" /></p>
<p>Edouard asks for some code that will automatically archive attachments on outgoing emails. Let's start with the code found at <a href="http://www.codeforexcelandoutlook.com/blog/2010/03/saving-compressed-attachments-in-windows-7outlook-2003/">Saving Compressed Attachments</a> and go from there.</p>
<p><span id="more-1191"></span></p>
<p>We'll also need some help from Ron de Bruin and his code to <a href="http://www.rondebruin.nl/windowsxpzip.htm">zip files using VBA</a>.</p>
<h2>The Application_ItemSend Event</h2>
<p>This Application-level event fires whenever any item is sent from Outlook. We'll use it to check any outgoing items to see if they are emails with attachments. If so, any unzipped attachments will be archived and re-attached to the email.</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> Application_ItemSend(<span style="color: #000080;">ByVal</span> Item <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>, Cancel <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span>)<br />
<br />
&nbsp; <span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">GoTo</span> ErrorHandler<br />
<br />
&nbsp; <span style="color: #000080;">Dim</span> msg <span style="color: #000080;">As</span> Outlook.MailItem<br />
&nbsp; <span style="color: #000080;">Dim</span> msgAttachments <span style="color: #000080;">As</span> Outlook.Attachments<br />
&nbsp; <span style="color: #000080;">Dim</span> attachmentsCount <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span><br />
&nbsp; <span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span><br />
&nbsp; <span style="color: #000080;">Dim</span> tempFolder <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
&nbsp; <span style="color: #000080;">Dim</span> zipFileAttachment <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
<br />
&nbsp; <span style="color: #008000;">' check if it's an email<br />
</span> &nbsp;<span style="color: #000080;">If</span> IsMail(Item) <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; <span style="color: #000080;">Set</span> msg = Item<br />
&nbsp; &nbsp; <span style="color: #008000;">' check if there are attachments<br />
</span> &nbsp; &nbsp;<span style="color: #000080;">Set</span> msgAttachments = GetAttachmentsColl(msg)<br />
&nbsp; &nbsp; attachmentsCount = msgAttachments.Count<br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">If</span> attachmentsCount &gt; 0 <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">' loop through attachments<br />
</span> &nbsp; &nbsp; &nbsp;<span style="color: #000080;">For</span> i = attachmentsCount <span style="color: #000080;">To</span> 1 <span style="color: #000080;">Step</span> -1<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">' look for non-zipped files<br />
</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000080;">If</span> <span style="color: #000080;">Not</span> IsArchive(msgAttachments.Item(i)) <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">' save to temp folder, create if nonexistent<br />
</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Randomize<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempFolder = Environ(<span style="color: #800000;">&quot;temp&quot;</span>) &amp; <span style="color: #800000;">&quot;\temp&quot;</span> &amp; Rnd &amp; <span style="color: #800000;">&quot;\&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">If</span> <span style="color: #000080;">Not</span> Len(Dir(tempFolder)) &gt; 0 <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MkDir tempFolder<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msgAttachments.Item(i).SaveAsFile tempFolder &amp; msgAttachments.Item(i).fileName<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">' remove from email<br />
</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;msgAttachments.Item(i).Delete<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000080;">Next</span> i<br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">' go through temp folder, zip all files there and attach back to email<br />
</span> &nbsp; &nbsp; &nbsp;zipFileAttachment = ZipFiles(tempFolder)<br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">' add zip file back to message<br />
</span> &nbsp; &nbsp; &nbsp;msgAttachments.Add zipFileAttachment<br />
&nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
ProgramExit:<br />
&nbsp; <span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">Resume</span> <span style="color: #000080;">Next</span><br />
&nbsp; Kill tempFolder<br />
&nbsp; <span style="color: #000080;">Exit</span> <span style="color: #000080;">Sub</span><br />
ErrorHandler:<br />
&nbsp; MsgBox Err.number &amp; <span style="color: #800000;">&quot; - &quot;</span> &amp; Err.Description<br />
&nbsp; <span style="color: #000080;">Resume</span> ProgramExit<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>Put this code in your ThisOutlookSession module (<a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a>) and restart Outlook. Go back to the VB IDE and set a breakpoint on the first line, then send an email with an attachment and watch it work!</p>
<p>The first thing we do is check if the given item is an email. If so, we grab the attachments collection using <a href="http://www.codeforexcelandoutlook.com/blog/2010/02/saving-attachments-in-outlook/">GetAttachmentsColl</a>. If there are attachments, we'll loop through the collection and check each one. The <strong>IsArchive</strong> function checks if a given attachment matches a pre-determined list of archive types (zip, rar). Add others if you wish.</p>
<p>If a non-archived file is found attached to the email, a temporary folder is created one level below the temp folder. The folder has a random number in it to severely limit the possibility of duplication (although we do delete it when the macro ends). The non-archived file is saved to the temp folder and removed as an attachment from the email.</p>
<p>The files in the temp folder are zipped and then the zip file is attached to the email. The temp folder (and all the files in it) are deleted.</p>
<p>Note that we loop backwards because we may be deleting attachments.</p>
<h2>Additional Functions</h2>
<p>You'll also need these functions in order for the event handler to work.</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Function</span> IsMail(itm <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span><br />
&nbsp; IsMail = (TypeName(itm) = <span style="color: #800000;">&quot;MailItem&quot;</span>)<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span><br />
<br />
<span style="color: #000080;">Function</span> GetAttachmentsColl(itm <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>) <span style="color: #000080;">As</span> Outlook.Attachments<br />
&nbsp; <span style="color: #000080;">Select</span> <span style="color: #000080;">Case</span> itm.Class<br />
&nbsp; <span style="color: #000080;">Case</span> olAppointment, olContact, olDocument, olMail, _<br />
&nbsp; &nbsp; &nbsp; &nbsp;olMeetingRequest, olPost, olReport, olTask, olTaskRequestAccept, _<br />
&nbsp; &nbsp; &nbsp; &nbsp;olTaskRequestDecline, olTaskRequest, olTaskRequestUpdate<br />
&nbsp; &nbsp; <span style="color: #000080;">Set</span> GetAttachmentsColl = itm.Attachments<br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">Select</span><br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span><br />
<br />
<span style="color: #000080;">Function</span> IsArchive(attachFileName <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span><br />
<br />
<span style="color: #000080;">Dim</span> archiveTypes() <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
<span style="color: #000080;">Dim</span> fileExt <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
<br />
&nbsp; archiveTypes = Split(<span style="color: #800000;">&quot;ZIP, RAR&quot;</span>, <span style="color: #800000;">&quot;,&quot;</span>)<br />
<br />
&nbsp; <span style="color: #008000;">' get file extension<br />
</span> &nbsp;fileExt = UCase$(GetFileType(attachFileName))<br />
<br />
&nbsp; <span style="color: #000080;">If</span> <span style="color: #000080;">UBound</span>(Filter(archiveTypes, fileExt)) &gt; -1 <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; IsArchive = <span style="color: #000080;">True</span><br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span><br />
<br />
<span style="color: #000080;">Function</span> GetFileType(<span style="color: #000080;">ByVal</span> fileName <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
<span style="color: #008000;">' get file extension<br />
</span> &nbsp;GetFileType = Mid$(fileName, InStrRev(fileName, <span style="color: #800000;">&quot;.&quot;</span>) + 1, Len(fileName))<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span><br />
<br />
<span style="color: #000080;">Function</span> ZipFiles(folder <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>, <span style="color: #000080;">Optional</span> fileName <span style="color: #000080;">As</span> <span style="color: #000080;">String</span> = <span style="color: #800000;">&quot;files&quot;</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
<span style="color: #008000;">' http://www.rondebruin.nl/windowsxpzip.htm<br />
</span><br />
<span style="color: #000080;">Dim</span> ZipFilename <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span><br />
<span style="color: #000080;">Dim</span> folderName <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span><br />
<span style="color: #000080;">Dim</span> ShellApp <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span><br />
<span style="color: #000080;">Dim</span> tempFolder <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span><br />
<br />
<span style="color: #000080;">Const</span> ZIP_FILE_EXTENSION <span style="color: #000080;">As</span> <span style="color: #000080;">String</span> = <span style="color: #800000;">&quot;.zip&quot;</span><br />
<br />
&nbsp; <span style="color: #008000;">' create filename, check for trailing slash<br />
</span> &nbsp;tempFolder = Environ(<span style="color: #800000;">&quot;temp&quot;</span>) &amp; <span style="color: #800000;">&quot;\&quot;</span><br />
<br />
&nbsp; ZipFilename = tempFolder &amp; fileName &amp; ZIP_FILE_EXTENSION<br />
<br />
&nbsp; <span style="color: #008000;">'Create empty Zip File<br />
</span> &nbsp;NewZip (ZipFilename)<br />
<br />
&nbsp; <span style="color: #000080;">Set</span> ShellApp = CreateObject(<span style="color: #800000;">&quot;Shell.Application&quot;</span>)<br />
<br />
&nbsp; <span style="color: #008000;">'Copy the files to the compressed folder<br />
</span> &nbsp;ShellApp.NameSpace(ZipFilename).CopyHere ShellApp.NameSpace(folder).Items<br />
<br />
&nbsp; <span style="color: #008000;">'Keep script waiting until Compressing is done<br />
</span> &nbsp;<span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">Resume</span> <span style="color: #000080;">Next</span><br />
&nbsp; <span style="color: #000080;">Do</span> <span style="color: #000080;">Until</span> ShellApp.NameSpace(ZipFilename).Items.Count = _<br />
&nbsp; &nbsp; &nbsp;ShellApp.NameSpace(folder).Items.Count<br />
&nbsp; &nbsp; Application.Wait (Now + TimeValue(<span style="color: #800000;">&quot;0:00:01&quot;</span>))<br />
&nbsp; <span style="color: #000080;">Loop</span><br />
&nbsp; <span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">GoTo</span> 0<br />
<br />
&nbsp; ZipFiles = ZipFilename<br />
<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span><br />
<br />
<span style="color: #000080;">Sub</span> NewZip(sPath)<br />
<span style="color: #008000;">' http://www.rondebruin.nl/windowsxpzip.htm<br />
</span><span style="color: #008000;">'Create empty Zip File<br />
</span><span style="color: #008000;">'Changed by keepITcool Dec-12-2005<br />
</span> &nbsp;<span style="color: #000080;">If</span> Len(Dir(sPath)) &gt; 0 <span style="color: #000080;">Then</span> Kill sPath<br />
&nbsp; <span style="color: #000080;">Open</span> sPath <span style="color: #000080;">For</span> <span style="color: #000080;">Output</span> <span style="color: #000080;">As</span> #1<br />
&nbsp; <span style="color: #000080;">Print</span> #1, Chr$(80) &amp; Chr$(75) &amp; Chr$(5) &amp; Chr$(6) &amp; <span style="color: #000080;">String</span>(18, 0)<br />
&nbsp; <span style="color: #000080;">Close</span> #1<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/zip-outgoing-attachments/">Zip outgoing attachments</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=ztc86wrH_ZU:1svxpKw39xY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=ztc86wrH_ZU:1svxpKw39xY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=ztc86wrH_ZU:1svxpKw39xY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/ztc86wrH_ZU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/07/zip-outgoing-attachments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delete duplicate contacts in Outlook using VBA</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/07/delete-duplicate-contacts-in-outlook-using-vba/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/07/delete-duplicate-contacts-in-outlook-using-vba/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 11:00:30 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Outlook]]></category>
		<category><![CDATA[contacts]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[Remove]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1189</guid>
		<description><![CDATA[Hey, how else were we going to do it? Deleting duplicate contacts is a tricky business. How do you decide when a pair of contacts are the same? Are they duplicates when they have the same name and phone number? What if one has the home address and the other doesn't? And what about the [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/delete-duplicate-contacts-in-outlook-using-vba/">Delete duplicate contacts in Outlook using VBA</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p>Hey, how else were we going to do it?</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/contacts.png" alt="contacts" title="contacts" /></p>
<p><span id="more-1189"></span></p>
<p>Deleting duplicate contacts is a tricky business. How do you decide when a pair of contacts are the same?</p>
<p><strong>Are they duplicates when they have the same name and phone number?<br />
What if one has the home address and the other doesn't?<br />
And what about the endless variations on a contact's name?</strong></p>
<p>Here's one way. The following code loops through the default Contacts folder and checks for another contact with the same full name. If it finds one, you're prompted to delete it.</p>
<p>To look for duplicates, we use the Restrict method, instead of comparing each contact to all the others (which would be very wasteful).</p>
<p>We create a new Items collection consisting of all the contacts with a given full name. If there are more than one, there's a duplicate (according to our criteria). The ancillary functions are used to return a reference to the Contacts folder Items collection.</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> DeleteDuplicateContacts()<br />
<br />
&nbsp; <span style="color: #000080;">Dim</span> contactItems <span style="color: #000080;">As</span> Outlook.Items<br />
&nbsp; <span style="color: #000080;">Dim</span> contact <span style="color: #000080;">As</span> Outlook.ContactItem<br />
&nbsp; <span style="color: #000080;">Dim</span> contactFullName <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
&nbsp; <span style="color: #000080;">Dim</span> filteredContacts <span style="color: #000080;">As</span> Outlook.Items<br />
&nbsp; <span style="color: #000080;">Dim</span> numberOfContacts <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span><br />
&nbsp; <span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span><br />
<br />
&nbsp; <span style="color: #000080;">Set</span> contactItems = GetItems(GetNS(GetOutlookApp), olFolderContacts)<br />
&nbsp; numberOfContacts = contactItems.Count<br />
<br />
&nbsp; <span style="color: #008000;">' loop through contact items folder<br />
</span> &nbsp;<span style="color: #000080;">For</span> i = numberOfContacts <span style="color: #000080;">To</span> 1 <span style="color: #000080;">Step</span> -1<br />
&nbsp; &nbsp; <span style="color: #000080;">If</span> IsContact(contactItems.Item(i)) <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000080;">Set</span> contact = contactItems.Item(i)<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; contactFullName = contact.FullName<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">' check if any other contacts have the same full name<br />
</span> &nbsp; &nbsp; &nbsp;<span style="color: #000080;">Set</span> filteredContacts = _<br />
&nbsp; &nbsp; contactItems.Restrict(<span style="color: #800000;">&quot;[FullName] = '&quot;</span> &amp; contactFullName &amp; <span style="color: #800000;">&quot;'&quot;</span>)<br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000080;">If</span> <span style="color: #000080;">Not</span> filteredContacts.Count = 1 <span style="color: #000080;">Then</span> <span style="color: #008000;">' possible dupe<br />
</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000080;">If</span> MsgBox(<span style="color: #800000;">&quot;Duplicate contact found, delete?&quot;</span> &amp; _<br />
&nbsp; &nbsp; vbCrLf &amp; contactFullName, vbYesNo) = vbYes <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contact.Delete<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
&nbsp; <span style="color: #000080;">Next</span> i<br />
<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span><br />
<br />
<span style="color: #000080;">Function</span> IsContact(itm <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span><br />
&nbsp; IsContact = (TypeName(itm) = <span style="color: #800000;">&quot;ContactItem&quot;</span>)<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span><br />
<br />
<span style="color: #000080;">Function</span> GetItems(olNS <span style="color: #000080;">As</span> Outlook.NameSpace, _<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; folder <span style="color: #000080;">As</span> OlDefaultFolders) <span style="color: #000080;">As</span> Outlook.Items<br />
<span style="color: #008000;">' returns the Items Collection for a given default<br />
</span><span style="color: #008000;">' folder and Namespace<br />
</span> &nbsp;<span style="color: #000080;">Set</span> GetItems = olNS.GetDefaultFolder(folder).Items<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span><br />
<br />
<span style="color: #000080;">Function</span> GetOutlookApp() <span style="color: #000080;">As</span> Outlook.Application<br />
<span style="color: #008000;">' returns reference to native Outlook.Application object<br />
</span> &nbsp;<span style="color: #000080;">Set</span> GetOutlookApp = Outlook.Application<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span><br />
<br />
<span style="color: #000080;">Function</span> GetNS(<span style="color: #000080;">ByRef</span> app <span style="color: #000080;">As</span> Outlook.Application) _<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000080;">As</span> Outlook.NameSpace<br />
<span style="color: #008000;">' returns a Namespace Object to access MAPIFolder objects<br />
</span> &nbsp;<span style="color: #000080;">Set</span> GetNS = app.GetNamespace(<span style="color: #800000;">&quot;MAPI&quot;</span>)<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></div></div>
<p>This code is meant to be used in Outlook and should be placed in a standard module in the Outlook VB IDE. <a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/delete-duplicate-contacts-in-outlook-using-vba/">Delete duplicate contacts in Outlook using VBA</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=JOs1aeiM-08:A9Q9mXTQ8K8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=JOs1aeiM-08:A9Q9mXTQ8K8:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=JOs1aeiM-08:A9Q9mXTQ8K8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/JOs1aeiM-08" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/07/delete-duplicate-contacts-in-outlook-using-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Which macro shortcut keys do you use?</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/07/which-macro-shortcut-keys-do-you-use/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/07/which-macro-shortcut-keys-do-you-use/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 11:00:52 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[hotkey]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[shortcut]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1187</guid>
		<description><![CDATA[A quick poll: What shortcut keys do you use for your macros, and what macros are they assigned to? Here are mine. They're not written as well as they could be, but I don't care. They work and that's good enough for me (until I get really bored; then I'll fix them). Shortcut key: Ctrl+Shift+P [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/which-macro-shortcut-keys-do-you-use/">Which macro shortcut keys do you use?</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p>A quick poll: What shortcut keys do you use for your macros, and what macros are they assigned to? Here are mine.</p>
<p><span id="more-1187"></span></p>
<p>They're not written as well as they could be, but I don't care. They work and that's good enough for me (until I get really bored; then I'll fix them).</p>
<p>Shortcut key: <strong>Ctrl+Shift+P</strong><br />
Macro name: CopyPasteValues<br />
Description: Converts formulas in selected range to their values<br />
Macro:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> CopyPasteValues()<br />
<br />
<span style="color: #000080;">Dim</span> rng <span style="color: #000080;">As</span> Excel.Range<br />
<br />
&nbsp; <span style="color: #000080;">If</span> TypeName(Selection) &lt;&gt; <span style="color: #800000;">&quot;Range&quot;</span> <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; <span style="color: #000080;">Exit</span> <span style="color: #000080;">Sub</span><br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; <span style="color: #000080;">Set</span> rng = Selection<br />
<br />
&nbsp; rng.Copy<br />
<br />
&nbsp; rng.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :=<span style="color: #000080;">False</span>, Transpose:=<span style="color: #000080;">False</span><br />
&nbsp; Application.CutCopyMode = <span style="color: #000080;">False</span><br />
<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>A quick way to remove formulas and paste in the underlying data.</p>
<p>Shortcut key: <strong>Ctrl+Shift+F</strong><br />
Macro name: FilterToggle<br />
Description: Adds autofilter arrows to selected range (usually row 1)<br />
Macro:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> FilterToggle()<br />
<span style="color: #008000;">' add data filter arrows<br />
</span><span style="color: #008000;">' if error occurs, just skip<br />
</span> &nbsp;<span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">Resume</span> <span style="color: #000080;">Next</span><br />
&nbsp; Selection.AutoFilter<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>Apply autofilter arrows to any worksheet. Just select the appropriate row first.</p>
<p>Shortcut key: <strong>Ctrl+Shift+H</strong><br />
Macro name: FormatHeaderRow<br />
Description: Applies autofilter arrows, bold and color formatting to row 1, centers row 1 text and autofits all columns<br />
Macro:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> FormatHeaderRow()<br />
<br />
&nbsp; Application.ScreenUpdating = <span style="color: #000080;">False</span><br />
<br />
&nbsp; <span style="color: #000080;">If</span> ActiveSheet.AutoFilterMode = <span style="color: #000080;">False</span> <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; <span style="color: #000080;">With</span> Range(Range(<span style="color: #800000;">&quot;A1&quot;</span>), Range(<span style="color: #800000;">&quot;IV1&quot;</span>).<span style="color: #000080;">End</span>(xlToLeft))<br />
&nbsp; &nbsp; &nbsp; .AutoFilter<br />
&nbsp; &nbsp; &nbsp; .Font.ColorIndex = 2<br />
&nbsp; &nbsp; &nbsp; .Font.Bold = <span style="color: #000080;">True</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000080;">With</span> .Interior<br />
&nbsp; &nbsp; &nbsp; &nbsp; .ColorIndex = 43<br />
&nbsp; &nbsp; &nbsp; &nbsp; .Pattern = xlSolid<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">With</span><br />
<br />
&nbsp; &nbsp; &nbsp; .HorizontalAlignment = xlCenter<br />
&nbsp; &nbsp; &nbsp; .WrapText = <span style="color: #000080;">False</span><br />
&nbsp; &nbsp; &nbsp; .Columns.AutoFit<br />
&nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">With</span><br />
<br />
&nbsp; &nbsp; <span style="color: #008000;">' &nbsp; &nbsp;Range(&quot;A2&quot;).Select<br />
</span> &nbsp; &nbsp;<span style="color: #008000;">' &nbsp; &nbsp;ActiveWindow.FreezePanes = True<br />
</span> &nbsp;<span style="color: #000080;">Else</span><br />
&nbsp; &nbsp; MsgBox _<br />
&nbsp; &nbsp; <span style="color: #800000;">&quot;Cannot autofilter the header row, there is already an autofilter on this sheet&quot;</span>, vbCritical<br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; Application.ScreenUpdating = <span style="color: #000080;">True</span><br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>This macro makes the header row (usually row 1) look exactly how I like it. The autofilter arrows are applied. The cells' text is centered. The font is bold, white with green background (I change this depending on my mood). Finally, the columns are autofit so I can see the entire header and all the data.</p>
<p>Optionally, I can freeze the window pane so that the header stays on the screen when scrolling.</p>
<p>Shortcut key: <strong>Ctrl+Shift+S</strong><br />
Macro name: SetNormal<br />
Description: Removes formatting from worksheet and makes it look "normal" (according to me)<br />
Macro:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> SetNormal()<br />
<span style="color: #008000;">' set worksheet to normal<br />
</span> &nbsp;Application.ScreenUpdating = <span style="color: #000080;">False</span><br />
<br />
&nbsp; <span style="color: #000080;">If</span> TypeName(Selection) &lt;&gt; <span style="color: #800000;">&quot;Range&quot;</span> <span style="color: #000080;">Then</span> <span style="color: #000080;">Exit</span> <span style="color: #000080;">Sub</span><br />
<br />
&nbsp; <span style="color: #000080;">Dim</span> rng <span style="color: #000080;">As</span> Excel.Range<br />
&nbsp; <span style="color: #000080;">Set</span> rng = Selection<br />
<br />
&nbsp; <span style="color: #000080;">If</span> rng.cells.count = 1 <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; <span style="color: #000080;">Set</span> rng = ActiveSheet.UsedRange<br />
&nbsp; &nbsp; ActiveWindow.Zoom = 80<br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; <span style="color: #000080;">With</span> rng<br />
&nbsp; &nbsp; .Borders(xlDiagonalDown).LineStyle = xlNone<br />
&nbsp; &nbsp; .Borders(xlDiagonalUp).LineStyle = xlNone<br />
&nbsp; &nbsp; .Borders(xlEdgeLeft).LineStyle = xlNone<br />
&nbsp; &nbsp; .Borders(xlEdgeTop).LineStyle = xlNone<br />
&nbsp; &nbsp; .Borders(xlEdgeBottom).LineStyle = xlNone<br />
&nbsp; &nbsp; .Borders(xlEdgeRight).LineStyle = xlNone<br />
&nbsp; &nbsp; .Borders(xlInsideVertical).LineStyle = xlNone<br />
&nbsp; &nbsp; .Borders(xlInsideHorizontal).LineStyle = xlNone<br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">With</span> .Font<br />
&nbsp; &nbsp; &nbsp; .Bold = <span style="color: #000080;">False</span><br />
&nbsp; &nbsp; &nbsp; .Name = <span style="color: #800000;">&quot;Tahoma&quot;</span><br />
&nbsp; &nbsp; &nbsp; .ColorIndex = 0<br />
&nbsp; &nbsp; &nbsp; .Size = 10<br />
&nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">With</span><br />
<br />
&nbsp; &nbsp; .Interior.ColorIndex = xlNone<br />
&nbsp; &nbsp; .HorizontalAlignment = xlGeneral<br />
&nbsp; &nbsp; .Orientation = 0<br />
&nbsp; &nbsp; .AddIndent = <span style="color: #000080;">False</span><br />
&nbsp; &nbsp; .IndentLevel = 0<br />
&nbsp; &nbsp; .ShrinkToFit = <span style="color: #000080;">False</span><br />
&nbsp; &nbsp; .MergeCells = <span style="color: #000080;">False</span><br />
&nbsp; &nbsp; .WrapText = <span style="color: #000080;">False</span><br />
&nbsp; &nbsp; .Rows.AutoFit<br />
&nbsp; &nbsp; .Columns.AutoFit<br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">With</span><br />
<br />
&nbsp; Application.ScreenUpdating = <span style="color: #000080;">True</span><br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>My "normal" is different from yours. I hate getting spreadsheets with different fonts, font sizes and colors. When I just want to work with the data and not be distracted by the layout, I run this macro. It sets the window zoom to 80%, with a Tahoma font (size 10). It removes any border lines and cell colors. It re-orients any cell to General alignment and unwraps any wrapped cells. Finally, it autofits all rows and columns so all data is visible.</p>
<p>Shortcut key: <strong>Ctrl+Shift+U</strong><br />
Macro name: TogglePersonalXls<br />
Description: Hides and unhides personal.xls workbook<br />
Macro:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> TogglePersonalXls()<br />
<span style="color: #008000;">' toggle personal.xls workbook hidden status<br />
</span><span style="color: #000080;">Dim</span> window <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span><br />
&nbsp; window = Windows(<span style="color: #800000;">&quot;PERSONAL.XLS&quot;</span>).Visible<br />
&nbsp; Windows(<span style="color: #800000;">&quot;PERSONAL.XLS&quot;</span>).Visible = <span style="color: #000080;">Not</span> window<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>I don't use this one much anymore, but the shortcut key is still there in case I need it. </p>
<p><strong>So what shortcut keys do you use, and what macros are assigned to them?</strong></p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/which-macro-shortcut-keys-do-you-use/">Which macro shortcut keys do you use?</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=iE3ffN4Lld8:fTj4dVWdTNg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=iE3ffN4Lld8:fTj4dVWdTNg:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=iE3ffN4Lld8:fTj4dVWdTNg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/iE3ffN4Lld8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/07/which-macro-shortcut-keys-do-you-use/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>What columns are filtered?</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/07/what-columns-are-filtered/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/07/what-columns-are-filtered/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 11:00:30 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[autofilter]]></category>
		<category><![CDATA[Filters]]></category>
		<category><![CDATA[worksheet]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1175</guid>
		<description><![CDATA[Ever set up a monster spreadsheet with dozens of columns, then autofilter it, then forget which columns are autofiltered? The little autofilter arrows turn blue when a filter is applied, but who wants to lose their eyesight scrolling across a worksheet looking for which ones are in effect? I don't. So I came up with [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/what-columns-are-filtered/">What columns are filtered?</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/question.png" alt="question"  title="question What columns are filtered?" /></p>
<p>Ever set up a monster spreadsheet with dozens of columns, then autofilter it, then forget which columns are autofiltered?</p>
<p>The little autofilter arrows turn blue when a filter is applied, but who wants to lose their eyesight scrolling across a worksheet looking for which ones are in effect?</p>
<p><span id="more-1175"></span></p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/autofilter_bluearrows.png" title="autofilter bluearrows What columns are filtered?" alt="autofilter bluearrows" /></p>
<p>I don't. So I came up with this little script that tells you which autofilter columns are actually in effect.</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> CheckFilter()<br />
<br />
<span style="color: #000080;">Dim</span> wksht <span style="color: #000080;">As</span> Excel.Worksheet<br />
<span style="color: #000080;">Dim</span> autofilt <span style="color: #000080;">As</span> Excel.AutoFilter<br />
<span style="color: #000080;">Dim</span> autofiltRange <span style="color: #000080;">As</span> Excel.Range<br />
<span style="color: #000080;">Dim</span> offsetRange <span style="color: #000080;">As</span> Excel.Range<br />
<span style="color: #000080;">Dim</span> flt <span style="color: #000080;">As</span> Excel.Filters<br />
<span style="color: #000080;">Dim</span> msg <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
<span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span><br />
<br />
<span style="color: #000080;">Set</span> wksht = ActiveSheet<br />
<br />
<span style="color: #000080;">If</span> wksht.FilterMode <span style="color: #000080;">Then</span><br />
&nbsp; <span style="color: #000080;">Set</span> flt = wksht.AutoFilter.Filters<br />
&nbsp;<br />
&nbsp; &nbsp;<span style="color: #000080;">For</span> i = 1 <span style="color: #000080;">To</span> flt.count<br />
&nbsp; &nbsp; <span style="color: #008000;">' if Filter is activated, get range name<br />
</span> &nbsp; &nbsp;<span style="color: #000080;">If</span> flt.item(i).<span style="color: #000080;">On</span> <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #008000;">' Filter parent is AutoFilter Object<br />
</span> &nbsp; &nbsp; &nbsp;<span style="color: #000080;">Set</span> autofilt = flt.item(i).Parent<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000080;">Set</span> autofiltRange = autofilt.Range<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000080;">Set</span> offsetRange = autofiltRange.Resize(1, 1).Offset(, i - 1)<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; msg = msg &amp; Range(offsetRange.Address).value &amp; vbCrLf<br />
&nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
&nbsp; &nbsp;<span style="color: #000080;">Next</span> i<br />
<br />
&nbsp; MsgBox wksht.Name &amp; <span style="color: #800000;">&quot; in &quot;</span> &amp; wksht.Parent.Name &amp; _<br />
&nbsp; &nbsp; <span style="color: #800000;">&quot; is filtered on the following columns: &quot;</span> &amp; vbCrLf &amp; msg<br />
<br />
<span style="color: #000080;">Else</span><br />
&nbsp; MsgBox <span style="color: #800000;">&quot;Worksheet is not filtered.&quot;</span><br />
<span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>I put this baby in my PERSONAL.XLS and when I run it, I get a popup telling me which column headers have the autofilter applied. Sweet! It's my <a href="http://www.dailydoseofexcel.com/archives/2010/06/18/formatting-pivot-tables/">giggle moment</a>.</p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/what-columns-are-filtered/">What columns are filtered?</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=pRBxGr1JN48:UOcqnI2ciO0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=pRBxGr1JN48:UOcqnI2ciO0:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=pRBxGr1JN48:UOcqnI2ciO0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/pRBxGr1JN48" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/07/what-columns-are-filtered/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding vacation days to Outlook in bulk from Excel</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/07/adding-vacation-days-to-outlook-in-bulk-from-excel/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/07/adding-vacation-days-to-outlook-in-bulk-from-excel/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 11:30:20 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[AppointmentItem]]></category>
		<category><![CDATA[BusyStatus]]></category>
		<category><![CDATA[CreateItem]]></category>
		<category><![CDATA[vacation]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1185</guid>
		<description><![CDATA[A friend sent me a spreadsheet with a list of dates. He wants to put them on his calendar as vacation days, but doesn't want to do it manually. Hooray, another free job. The list of dates starts in cell A2, with A1 being a header row. Nice! I love those kinds of worksheets. All [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/adding-vacation-days-to-outlook-in-bulk-from-excel/">Adding vacation days to Outlook in bulk from Excel</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/goonvacation.png" alt="goonvacation" title="vacation" /></p>
<p>A friend sent me a spreadsheet with a list of dates. He wants to put them on his calendar as vacation days, but doesn't want to do it manually. Hooray, another free job.</p>
<p><span id="more-1185"></span></p>
<p>The list of dates starts in cell A2, with A1 being a header row. Nice! I love those kinds of worksheets.</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/vacationdates.png" alt="vacationdates" title="dates" /></p>
<p>All we need now is a little procedure to loop through the range and add an appointment to the Outlook calendar, making it a vacation day. Here's what I came up with.</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> CreateAppointments(<span style="color: #000080;">Optional</span> subject <span style="color: #000080;">As</span> <span style="color: #000080;">String</span> = <span style="color: #800000;">&quot;Vacation&quot;</span>, _<br />
&nbsp; &nbsp; <span style="color: #000080;">Optional</span> columnLetter <span style="color: #000080;">As</span> <span style="color: #000080;">String</span> = <span style="color: #800000;">&quot;A&quot;</span>)<br />
<br />
<span style="color: #000080;">Dim</span> cell <span style="color: #000080;">As</span> Excel.Range<br />
<span style="color: #000080;">Dim</span> rng <span style="color: #000080;">As</span> Excel.Range<br />
<span style="color: #000080;">Dim</span> wholeColumn <span style="color: #000080;">As</span> Excel.Range<br />
<span style="color: #000080;">Dim</span> startingCell <span style="color: #000080;">As</span> Excel.Range<br />
<span style="color: #000080;">Dim</span> oApp <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span> &nbsp;<span style="color: #008000;">' Outlook.Application<br />
</span><span style="color: #000080;">Dim</span> appt <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span> &nbsp;<span style="color: #008000;">' Outlook.AppointmentItem<br />
</span><span style="color: #000080;">Dim</span> wkbk <span style="color: #000080;">As</span> Excel.Workbook<br />
<span style="color: #000080;">Dim</span> wksht <span style="color: #000080;">As</span> Excel.Worksheet<br />
<span style="color: #000080;">Dim</span> lastRow <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span><br />
<span style="color: #000080;">Dim</span> arrData <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span><br />
<span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span><br />
<br />
&nbsp; <span style="color: #008000;">' late bound constants<br />
</span><span style="color: #000080;">Const</span> olAppointmentItem <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span> = 1<br />
<span style="color: #000080;">Const</span> olOutOfOffice <span style="color: #000080;">As</span> <span style="color: #000080;">Long</span> = 3<br />
<br />
&nbsp; <span style="color: #008000;">' get range of dates<br />
</span> &nbsp;<span style="color: #000080;">Set</span> wkbk = ActiveWorkbook<br />
&nbsp; <span style="color: #000080;">Set</span> wksht = wkbk.ActiveSheet<br />
&nbsp; <span style="color: #000080;">Set</span> wholeColumn = wksht.Range(columnLetter &amp; <span style="color: #800000;">&quot;:&quot;</span> &amp; columnLetter)<br />
&nbsp; lastRow = wholeColumn.<span style="color: #000080;">End</span>(xlDown).Row - 2<br />
&nbsp; <span style="color: #000080;">Set</span> startingCell = wksht.Range(columnLetter &amp; <span style="color: #800000;">&quot;2&quot;</span>)<br />
&nbsp; <span style="color: #000080;">Set</span> rng = wksht.Range(startingCell, startingCell.Offset(lastRow))<br />
<br />
&nbsp; <span style="color: #008000;">' start Outlook<br />
</span> &nbsp;<span style="color: #000080;">Set</span> oApp = GetOutlookApp<br />
<br />
&nbsp; <span style="color: #000080;">If</span> oApp <span style="color: #000080;">Is</span> <span style="color: #000080;">Nothing</span> <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; MsgBox <span style="color: #800000;">&quot;Could not start Outlook.&quot;</span>, vbInformation<br />
&nbsp; &nbsp; <span style="color: #000080;">Exit</span> <span style="color: #000080;">Sub</span><br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; <span style="color: #008000;">' read range into array in one go<br />
</span> &nbsp;arrData = Application.Transpose(rng.Value)<br />
<br />
&nbsp; <span style="color: #008000;">' loop through array, not range<br />
</span> &nbsp;<span style="color: #000080;">For</span> i = <span style="color: #000080;">LBound</span>(arrData) <span style="color: #000080;">To</span> <span style="color: #000080;">UBound</span>(arrData)<br />
<br />
&nbsp; &nbsp; <span style="color: #008000;">' create new appt and set appropriate properties<br />
</span> &nbsp; &nbsp;<span style="color: #000080;">Set</span> appt = oApp.CreateItem(olAppointmentItem)<br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">With</span> appt<br />
&nbsp; &nbsp; &nbsp; .AllDayEvent = <span style="color: #000080;">True</span> &nbsp;<span style="color: #008000;">' block out the whole day<br />
</span> &nbsp; &nbsp; &nbsp;.body = subject<br />
&nbsp; &nbsp; &nbsp; .Start = arrData(i) &nbsp;<span style="color: #008000;">' no need to set End Property for all-day events<br />
</span> &nbsp; &nbsp; &nbsp;.subject = subject<br />
&nbsp; &nbsp; &nbsp; .BusyStatus = olOutOfOffice<br />
&nbsp; &nbsp; &nbsp; .ReminderSet = <span style="color: #000080;">False</span> &nbsp;<span style="color: #008000;">' no need for reminder, right?<br />
</span> &nbsp; &nbsp; &nbsp;.Save<br />
&nbsp; &nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">With</span><br />
&nbsp; <span style="color: #000080;">Next</span> i<br />
<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span><br />
<br />
<span style="color: #000080;">Function</span> GetOutlookApp() <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span><br />
<span style="color: #008000;">' return Outlook.Application object<br />
</span> &nbsp;<span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">Resume</span> <span style="color: #000080;">Next</span><br />
&nbsp; <span style="color: #000080;">Set</span> GetOutlookApp = CreateObject(<span style="color: #800000;">&quot;Outlook.Application&quot;</span>)<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></div></div>
<p>The procedure lets you decide what you want to call each appointment. I assume "Vacation", but if you were using this procedure to block out a series of dates for a professional development conference, you would call it something else.</p>
<p>You can also specify the column, if the data is somewhere other than column A. For example, if your dates were in column H starting in cell H2, with H1 as the header cell, you would call the function like this:</p>
<p><strong>Call CreateAppointments(, "H")</strong></p>
<p>The first thing the procedure does is determine the range being used to hold the dates. After starting Outlook, the range is read into a Variant (array) and then looped. For a simple task like this we could have also used a 'For Each cell in Range'-type loop, but I chose to actually follow best practices and use an array instead of touching the worksheet repeatedly.</p>
<p>For each appointment, we set three key properties: <strong>AllDayEvent</strong>, <strong>Start</strong> and <strong>BusyStatus</strong>. These are the ones that will make each one a vacation day.</p>
<h3>Sample Usage</h3>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Sub</span> TestCreateAppt()<br />
<br />
&nbsp; <span style="color: #000080;">Call</span> CreateAppointments(<span style="color: #800000;">&quot;On my way to Excel DevCon 2010&quot;</span>)<br />
<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p><a class="filedl" href="http://www.codeforexcelandoutlook.com/wkbks/BulkVacationDays.xls">Download sample workbook</a></p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/adding-vacation-days-to-outlook-in-bulk-from-excel/">Adding vacation days to Outlook in bulk from Excel</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=wcRvbxjN4Ns:WY7bK1u0j6g:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=wcRvbxjN4Ns:WY7bK1u0j6g:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=wcRvbxjN4Ns:WY7bK1u0j6g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/wcRvbxjN4Ns" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/07/adding-vacation-days-to-outlook-in-bulk-from-excel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>World Cup Flags</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/07/world-cup-flags/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/07/world-cup-flags/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 11:30:39 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Enabled]]></category>
		<category><![CDATA[flags]]></category>
		<category><![CDATA[split]]></category>
		<category><![CDATA[userform]]></category>
		<category><![CDATA[WebBrowser]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1186</guid>
		<description><![CDATA[If you're like me, stuck at work while the World Cup rages, you might still be lucky enough to be able to visit FIFA.com and watch the play-by-play. I'm not a big soccer fan but I depend on the realtime play-by-play to tell me what's happening during the game. You might have also noticed those [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/world-cup-flags/">World Cup Flags</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/WorldCupFlagsTop.png" alt="World Cup Flags circle" title="World Cup Flags circle" /></p>
<p>If you're like me, stuck at work while the World Cup rages, you might still be lucky enough to be able to visit FIFA.com and watch the play-by-play. I'm not a big soccer fan but I depend on the realtime play-by-play to tell me what's happening during the game.</p>
<p>You might have also noticed those cool country flags on FIFA's website. </p>
<div align="center"><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/alg.gif" alt="Algeria flag" title="Algeria flag" />&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://i929.photobucket.com/albums/ad137/jp2112jp/arg.gif" alt="Argentina flag" title="Argentina flag" />&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://i929.photobucket.com/albums/ad137/jp2112jp/bra.gif" alt="Brazil flag" title="Brazil flag" />&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://i929.photobucket.com/albums/ad137/jp2112jp/gre.gif" alt="Greece flag" title="Greece flag" />&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://i929.photobucket.com/albums/ad137/jp2112jp/por.gif" alt="Portugal flag" title="Portugal flag" />&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://i929.photobucket.com/albums/ad137/jp2112jp/svn.gif" alt="Slovenia flag" title="Slovenia flag" /></div>
<p>Fortunately, they are downloadable for use in your Excel worksheets and VBA programs. Let's build a small app to display and save them.</p>
<p><span id="more-1186"></span></p>
<p>If you right-click on the flag images on the FIFA homepage, the URL looks like this (for Algeria):</p>
<p><strong>http://img.fifa.com/imgml/flags/m/alg.gif</strong></p>
<p>The icon-size flags have the following URL:</p>
<p><strong>http://img.fifa.com/imgml/flags/s/alg.gif</strong></p>
<p>On a hunch, I tried this URL to get a large size flag:</p>
<p><strong>http://img.fifa.com/imgml/flags/l/alg.gif</strong></p>
<p>The FIFA homepage also has flags with cool mirror reflections under them. They follow a similar naming scheme, but only medium size images are available in reflected form:</p>
<p><strong>http://img.fifa.com/imgml/flags/reflected/m/alg.png</strong></p>
<p>So to build a string that points to the correct flag, we just need to determine what size we want, and the country abbreviation as well as which version we want (normal or reflected). If we want a reflected image, we can only request medium. Note that the reflected images are PNG, while the normal ones are GIF.</p>
<h2>The Userform</h2>
<p>The first thing I did was create a String list of <a href="http://www.fifa.com/worldcup/teams/index.html" rel="nofollow">World Cup countries</a>:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Public</span> <span style="color: #000080;">Const</span> COUNTRY_LIST <span style="color: #000080;">As</span> <span style="color: #000080;">String</span> = <span style="color: #800000;">&quot;ALG,ARG,AUS,BRA,CHI,CIV,CMR,DEN,ENG,ESP,FRA,&quot;</span> _<br />
&nbsp; &nbsp; &nbsp;&amp; <span style="color: #800000;">&quot;GER,GHA,GRE,HON,ITA,JPN,KOR,MEX,NED,NGA,NZL,PAR,&quot;</span> _<br />
&nbsp; &nbsp; &nbsp;&amp; <span style="color: #800000;">&quot;POR,PRK,RSA,SRB,SUI,SVK,SVN,URU,USA&quot;</span></div></div>
<p>Note that you can also get the flags for other countries, provided you know the three-letter abbreviation.</p>
<p>And you can feel free to add more to the app by visiting the <a rel="nofollow" href="http://www.fifa.com/worldcup/archive/index.html">FIFA World Cup Archives</a> and adding past teams. You could even add a combo box for the year and have a different set of teams load into the listbox depending on which year you select!</p>
<p>To load the list of countries into a listbox on my userform, I used the following code:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> UserForm_Initialize()<br />
<br />
&nbsp; <span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">GoTo</span> ErrorHandler<br />
<br />
&nbsp; <span style="color: #000080;">Dim</span> countriesList() <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
<br />
&nbsp; countriesList = Split(COUNTRY_LIST, <span style="color: #800000;">&quot;,&quot;</span>)<br />
<br />
&nbsp; Me.CountriesList.List = countriesList<br />
<br />
ProgramExit:<br />
&nbsp; <span style="color: #000080;">Exit</span> <span style="color: #000080;">Sub</span><br />
ErrorHandler:<br />
&nbsp; MsgBox Err.Number &amp; <span style="color: #800000;">&quot; - &quot;</span> &amp; Err.Description<br />
&nbsp; <span style="color: #000080;">Resume</span> ProgramExit<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>When the userform loads, this code splits the global constant COUNTRY_LIST by comma into a String array. This is passed into a listbox using its List Property.</p>
<p>The flag is displayed when an item from the listbox is selected. The ListBox_Click event builds the URL string based on the selections made on the form. A WebBrowser control is used to display the image, rather than trying to download it and load it into an Image control. That means you can right-click the control when a flag is displayed and save it to a folder!</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> CountriesList_Click()<br />
<br />
&nbsp; <span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">GoTo</span> ErrorHandler<br />
<br />
&nbsp; <span style="color: #000080;">Dim</span> imageSize <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
&nbsp; <span style="color: #000080;">Dim</span> Reflected <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span><br />
&nbsp; <span style="color: #000080;">Dim</span> URL <span style="color: #000080;">As</span> <span style="color: #000080;">String</span><br />
<br />
&nbsp; <span style="color: #008000;">' when a country is selected, check size and reflected<br />
</span> &nbsp;imageSize = GetImageSize<br />
&nbsp; Reflected = IsReflected<br />
<br />
&nbsp; <span style="color: #008000;">' if reflected image is requested, size MUST be medium<br />
</span> &nbsp;<span style="color: #000080;">If</span> Reflected <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; imageSize = <span style="color: #800000;">&quot;m&quot;</span><br />
&nbsp; &nbsp; Me.optMedium.Value = <span style="color: #000080;">True</span><br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; <span style="color: #008000;">' start with global base URL<br />
</span> &nbsp;URL = BASE_URL<br />
<br />
&nbsp; <span style="color: #008000;">' add reflected (if necessary)<br />
</span> &nbsp;<span style="color: #000080;">If</span> Reflected <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; URL = URL &amp; <span style="color: #800000;">&quot;reflected&quot;</span> &amp; <span style="color: #800000;">&quot;/&quot;</span><br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; <span style="color: #008000;">' add imagesize<br />
</span> &nbsp;URL = URL &amp; imageSize &amp; <span style="color: #800000;">&quot;/&quot;</span><br />
<br />
&nbsp; <span style="color: #008000;">' add country abbrevation<br />
</span> &nbsp;URL = URL &amp; Me.CountriesList.Value<br />
<br />
&nbsp; <span style="color: #008000;">' if reflected, add .png extension, else .gif<br />
</span> &nbsp;<span style="color: #000080;">If</span> Reflected <span style="color: #000080;">Then</span><br />
&nbsp; &nbsp; URL = URL &amp; <span style="color: #800000;">&quot;.png&quot;</span><br />
&nbsp; <span style="color: #000080;">Else</span><br />
&nbsp; &nbsp; URL = URL &amp; <span style="color: #800000;">&quot;.gif&quot;</span><br />
&nbsp; <span style="color: #000080;">End</span> <span style="color: #000080;">If</span><br />
<br />
&nbsp; <span style="color: #008000;">' display image in web browser control<br />
</span> &nbsp;Me.ImageViewer.Navigate URL<br />
<br />
ProgramExit:<br />
&nbsp; <span style="color: #000080;">Exit</span> <span style="color: #000080;">Sub</span><br />
ErrorHandler:<br />
&nbsp; MsgBox Err.Number &amp; <span style="color: #800000;">&quot; - &quot;</span> &amp; Err.Description<br />
&nbsp; <span style="color: #000080;">Resume</span> ProgramExit<br />
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></div></div>
<p>Here is the finished product:</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/WorldFlagsScreenshot.png" alt="World Flags program" title="World Flags program" /></p>
<h2>Download</h2>
<p><a class="filedl" href="http://www.codeforexcelandoutlook.com/wkbks/WorldCupFlags.xls">Download sample workbook</a></p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/world-cup-flags/">World Cup Flags</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=rLHHFX43Zqw:enSwOz3t-R4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=rLHHFX43Zqw:enSwOz3t-R4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=rLHHFX43Zqw:enSwOz3t-R4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/rLHHFX43Zqw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/07/world-cup-flags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Searching for a between formula</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/07/searching-for-a-between-formula/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/07/searching-for-a-between-formula/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 11:00:58 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[between]]></category>
		<category><![CDATA[MEDIAN]]></category>
		<category><![CDATA[N]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1183</guid>
		<description><![CDATA[In Between Formula in Excel, Chandoo presents some formulas for determining if a given value is in between two known values. Let's say you have a target value in B3. Start and end values are in cells C3 and D3, respectively. The first formula Chandoo presents to determine if the value in B3 is between [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/searching-for-a-between-formula/">Searching for a between formula</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://chandoo.org/wp/2010/06/24/between-formula-excel/">Between Formula in Excel</a>, Chandoo presents some formulas for determining if a given value is in between two known values.</p>
<p><span id="more-1183"></span></p>
<p>Let's say you have a target value in B3. Start and end values are in cells C3 and D3, respectively.</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/StartRange.png" alt="start range" title="start range" /></p>
<p>The first formula Chandoo presents to determine if the value in B3 is between C3 and D3 is:</p>
<p><strong>=IF(AND(B3&gt;=C3,B3&lt;=D3),"Yes", "No")</strong></p>
<p>It assumes that C3 is smaller than D3. Here's one possible correction:</p>
<p><strong>=OR(AND(B3&gt;=C3,B3&lt;=D3),AND(B3&lt;=C3,B3&gt;=D3))</strong></p>
<p>This would correct the first formula in situations when the cell values in C3 and D3 were switched (i.e. the ending value is less than the starting value).</p>
<p>But here's one problem. What's your definition of "between"?</p>
<p>In my example, both formulas return <strong>True</strong> when checking if 10 is "between" 10 and 20. You may not want that. I know I would only consider the numbers 11 through 19 to be between 10 and 20.</p>
<p>To fix this, all we need to do is remove the equal signs from both formulas:</p>
<p><strong>=IF(AND(B3&gt;C3,B3&lt;D3),"Yes", "No")</strong></p>
<p><strong>=OR(AND(B3&gt;C3,B3&lt;D3),AND(B3&lt;C3,B3&gt;D3))</strong></p>
<p>Daniel Ferry <a href="http://chandoo.org/wp/2010/06/24/between-formula-excel/#comment-113154">goes a step further</a>. He recognizes that the MEDIAN function will return the middle number in a set of three. So for any given number, if it falls between a given starting and ending number (a total of three values), the MEDIAN function will return the given number.</p>
<p><strong>=B3=MEDIAN(B3:D3)</strong></p>
<p>To exclude the starting and ending numbers (to get a true "between" check), this version of the formula will work:</p>
<p><strong>=B3=MEDIAN(B3,C3+1,D3-1)</strong></p>
<p>But I want something a bit more flexible. So I set up Data Validation in cell H2 as follows:</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/DataValMedian.png" alt="data validation" title="data validation" /></p>
<p>Now I can use the following formula, and cell H2 will be my "toggle button" to switch between inclusive and exclusive "between" formulas. In fact, we can use an actual <a href="http://www.codeforexcelandoutlook.com/blog/2010/02/excel-worksheet-interactivity-with-activex-controls/">toggle button</a>!</p>
<p><strong>=B3=MEDIAN(B3,C3+N(H2),D3-N(H2))</strong></p>
<p>The N function converts TRUE and FALSE values in cell H2 to 1 and 0 respectively. If H2 is TRUE, then the formula becomes</p>
<p><strong>=B3=MEDIAN(B3,C3+1,D3-1)</strong></p>
<p>and the formula is exclusive. It will return FALSE in the topmost example. If H2 is FALSE, the formula is</p>
<p><strong>=B3=MEDIAN(B3,C3+0,D3-0)</strong></p>
<p>and the formula is inclusive. It will return TRUE in the topmost example.</p>
<p>Download a workbook with all of these formulas: <a class="filedl" href="http://www.codeforexcelandoutlook.com/wkbks/between.xls">Between Formulas</a></p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/07/searching-for-a-between-formula/">Searching for a between formula</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=VvZ4kYZQxdg:I483nhV8EdU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=VvZ4kYZQxdg:I483nhV8EdU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=VvZ4kYZQxdg:I483nhV8EdU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/VvZ4kYZQxdg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/07/searching-for-a-between-formula/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Office Links for June</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/06/office-links-for-june/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/06/office-links-for-june/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 11:00:36 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Office Cafe]]></category>
		<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1177</guid>
		<description><![CDATA[It was a busy month! Here's the link roundup. UK Excel Developer Conference Excel DevCon 2010 was announced, and there has been a lot of blogging about it. Simon Murphy, Ross McLean and Charles Williams (of Decision Models) will be presenting. Ross links to the venue and the agenda. He also included a nice photo [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/06/office-links-for-june/">Office Links for June</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/VeryBusy.png" alt="busy" title="VeryBusy Office Links for June" /></p>
<p>It was a busy month! Here's the link roundup.</p>
<p><span id="more-1177"></span></p>
<h2>UK Excel Developer Conference</h2>
<p>Excel DevCon 2010 was announced, and there has been a lot of blogging about it. Simon Murphy, Ross McLean and Charles Williams (of <a href="http://www.decisionmodels.com/">Decision Models</a>) will be presenting.</p>
<p><a href="http://www.blog.methodsinexcel.co.uk/2010/06/14/excel-dev-con-2010-%E2%80%93-london-uk/">Ross</a> links to the venue and the agenda. He also included a nice photo showing England's goalie making a save.</p>
<p><a href="http://smurfonspreadsheets.wordpress.com/2010/06/12/excel-dev-conf-details/">Simon</a> provides booking details. If you are going, book now to take advantage of the discount (150 GBP vs 200 GBP in July).</p>
<p>Visit <a href="http://www.codematic.net/excel-developer-conference-2010.htm">Excel Developer Conference</a> for more information and booking details.</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/Soccer-Ball-icon-28x28.png" style="float:right;" align="absmiddle" title="Soccer Ball icon 28x28 Office Links for June" alt="Soccer Ball icon 28x28" /></p>
<h2>Soccer Mania</h2>
<p>The Excel Team Blog has extended their <a href="http://blogs.msdn.com/b/excel/archive/2010/06/09/deadline-extended-excel-2010-developer-challenge-soccer-edition.aspx">World Cup / Excel 2010 Soccer Challenge</a>. If you have an Excel workbook for tracking World Cup scores, make it stand out by adding realtime scores updated from the web by visiting <a href="http://www.codeforexcelandoutlook.com/blog/2010/06/howd-they-do-that-realtime-world-cup-scores/">Realtime World Cup Scores</a>.</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/updownarrows.png" style="float:right;" align="absmiddle" title="updownarrows Office Links for June" alt="updownarrows" /></p>
<h2>Sentence Case</h2>
<p>In <a href="http://chandoo.org/wp/2010/06/07/convert-to-sentence-case-excel-formula/">Convert to Sentence Case</a>, Chandoo provides a formula for converting to sentence case (that is, first word capitalizes, the rest lower case). I've also written an article about <a href="http://www.codeforexcelandoutlook.com/excel-vba/case-changing-in-excel/">case changing in Excel</a>, which includes some VBA functions for doing the same.</p>
<p>My concern is that some proper nouns will be skipped, but coding the logic would be very difficult, even with VBA. I'm sure there's a way to leverage the <a href="http://www.codeforexcelandoutlook.com/vba/wordnik-api/">Wordnik API</a> here to check for proper noun capitalization.</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/msdn_logo_sm.png" style="float:right;" align="absmiddle" title="msdn logo sm Office Links for June" alt="msdn logo sm" /></p>
<h2>MSDN Links</h2>
<p>Microsoft went crazy this month, adding a lot of content to their Office Developer section. Here are just a few of the links:</p>
<p>Visit <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=035b72a5-eef9-4baf-8dbc-63fbd2dd982b">Windows API Declarations and Constants</a> for a list of Windows API declarations. Includes 64-bit declarations for Office 2010!</p>
<p>For assistance creating charts in Word 2010 using VBA, see <a href="http://msdn.microsoft.com/en-us/library/ff629397(office.14).aspx">Creating Charts with VBA in Word 2010</a>. The code used in the article may be downloaded <a href="http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=odcwd2010ta&#038;ReleaseId=4217">here</a>.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ee692174%28office.14%29.aspx">What's new for developers in Outlook 2010</a> lists new members for various objects in the Outlook object model.</p>
<p>If you develop solutions for Office 2010 and want to see some icons you can use, visit <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2d3a18a2-2e75-4e43-8579-d543c19d0eed&#038;displaylang=en">Office 2010 Add-In: Icons Gallery</a>. You'll need Word 2010 or a compatible viewer.</p>
<p>A few more MSDN articles you might be interested in:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ff700513%28office.11%29.aspx">Working with VBA in Office 2010 (32-bit) and Office 2010 (64-bit)</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ff726673%28office.14%29.aspx">Excel 2010 Performance: Optimizing Performance Obstructions</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ff700514%28office.14%29.aspx">Excel 2010 Performance: Performance and Limit Improvements</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ff700515%28office.14%29.aspx">Excel 2010 Performance: Improving Calculation Performance</a></li>
</ul>
<p>Microsoft has also introduced the VBA Developer Center, which may be accessed from <a href="http://msdn.microsoft.com/en-us/office/ff688774.aspx">Office VBA Developer Center</a> or the aptly-named <a href="http://www.iheartmacros.com/">iheartmacros.com</a> (via <a href="http://blogs.msdn.com/b/johnrdurant/archive/2010/06/07/new-office-vba-site-launch-on-msdn.aspx">John Durant's blog</a>).</p>
<p>If you want to see MSDN updates in your RSS reader, instead of waiting for me to post them, add the <a href="http://www.microsoft.com/feeds/msdn/en-us/office/rss.xml">Microsoft Office Developer Center RSS Feed</a> to your reader.</p>
<p>For a free 184-page E-book about Office 2010, visit <a href="http://office.microsoft.com/en-us/access-help/first-look-microsoft-office-2010-HA101822265.aspx">First Look: Microsoft Office 2010</a>.</p>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/new.png" style="float:right;" align="absmiddle" title="new Office Links for June" alt="new" /></p>
<h2>New Pages</h2>
<p>I've been steadily documenting the Outlook Object Model with encapsulated functions and sample VBA code.</p>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/outlook-2003-object-model-breakdown-%e2%80%94-the-appointmentitem-object/">The AppointmentItem Object</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/outlook-2003-object-model-breakdown-%e2%80%94-the-mailitem-object/">The MailItem Object</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/outlook-2003-object-model-breakdown-%e2%80%94-the-postitem-object/">The PostItem Object</a></li>
</ul>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/wordnik_small.png" style="float:right;" align="absmiddle" title="wordnik small Office Links for June" alt="wordnik small" /></p>
<h2>Sample Wordnik App</h2>
<p>I've posted a sample Word add-in that utilizes the Wordnik API on the <a href="http://www.codeforexcelandoutlook.com/vba/wordnik-api/#sampleapp">Wordnik API</a> code samples page. The application is called <strong>Wordnik For Word</strong> and it uses several of the methods available on that page. I'm planning on updating that page shortly with new developments from Wordnik.</p>
<h2>Bad Behaviour</h2>
<p>Have you been blocked by the <a href="http://www.bad-behavior.ioerror.us/">Bad Behaviour</a> plugin? If so, let me know.</p>
<p>The plugin analyzes user agent behavior (among other things) to block malicious access attempts. Invariably, it may block legitimate access attempts, but displays a Turing test to allow you to quickly get past the block.</p>
<h2>Code Requests</h2>
<p>I've asked before, but I'll ask again: <strong>is there some piece of code you'd like to see here?</strong> </p>
<p>If so, leave a comment and I'll do my best to get it done. I do have a list of posts I'm working on, but I don't know what you want to see unless you tell me.</p>
<p>If you'd like to contribute, visit the <a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute</a> page and submit your post for consideration.</p>
<p>And by the way, while you're here, take the <a href="http://www.codeforexcelandoutlook.com/home/visitor-survey/">visitor survey</a>. Your responses will help make this a better site.</p>
<p>See you next time.</p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/06/office-links-for-june/">Office Links for June</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=xvuruL4g46Y:bYkqkvj_Ihk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=xvuruL4g46Y:bYkqkvj_Ihk:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=xvuruL4g46Y:bYkqkvj_Ihk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/xvuruL4g46Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/06/office-links-for-june/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Convert text to numbers in Excel</title>
		<link>http://www.codeforexcelandoutlook.com/blog/2010/06/convert-text-to-numbers-in-excel/</link>
		<comments>http://www.codeforexcelandoutlook.com/blog/2010/06/convert-text-to-numbers-in-excel/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 11:00:40 +0000</pubDate>
		<dc:creator>JP</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://www.codeforexcelandoutlook.com/?p=1176</guid>
		<description><![CDATA[Sometimes I get a spreadsheet with a list of numbers in text format. The fastest way I found to convert them into numbers was to select them and then run this little bit of VBA code, typed directly into the Immediate Window: selection.value = selection.value Before: After: Of course, if your numbers have leading zeroes, [...]<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/06/convert-text-to-numbers-in-excel/">Convert text to numbers in Excel</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
]]></description>
			<content:encoded><![CDATA[<p>Sometimes I get a spreadsheet with a list of numbers in text format.</p>
<p><span id="more-1176"></span></p>
<p>The fastest way I found to convert them into numbers was to select them and then run this little bit of VBA code, typed directly into the Immediate Window:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:630px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">selection.value = selection.value</div></div>
<h2>Before:</h2>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/NumbersBeforeConvert.png" alt="numbers before conversion" title="NumbersBeforeConvert Convert text to numbers in Excel" /></p>
<h2>After:</h2>
<p><img src="http://i929.photobucket.com/albums/ad137/jp2112jp/NumbersAfterConvert.png" alt="numbers after conversion" title="NumbersAfterConvert Convert text to numbers in Excel" /></p>
<p>Of course, if your numbers have leading zeroes, you'll need to make other arrangements. What do you do?</p>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2010/06/convert-text-to-numbers-in-excel/">Convert text to numbers in Excel</a> is Copyright &copy; <a href="http://www.codeforexcelandoutlook.com/">Code For Excel And Outlook</a>. All Rights Reserved.

<h3>More stuff:</h3>
<ul>
<li><a href="http://www.codeforexcelandoutlook.com/outlook-vba/where-do-i-put-my-outlook-vba-code/">Where do I put my Outlook code?</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/blog/contribute/">Contribute to this blog</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/vba-search-engine/">VBA Search Engine</a></li>
<li><a href="http://www.codeforexcelandoutlook.com/site-map/">Site Map</a></li>
</ul>
</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=FaTYX0ZljGQ:GkZQknovH8A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?i=FaTYX0ZljGQ:GkZQknovH8A:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?a=FaTYX0ZljGQ:GkZQknovH8A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/CodeForExcelAndOutlook?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/CodeForExcelAndOutlook/~4/FaTYX0ZljGQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codeforexcelandoutlook.com/blog/2010/06/convert-text-to-numbers-in-excel/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>
