{"id":1938,"date":"2008-10-30T19:09:35","date_gmt":"2008-10-31T00:09:35","guid":{"rendered":"http:\/\/www.allyngibson.net\/?p=1938"},"modified":"2008-10-30T19:09:35","modified_gmt":"2008-10-31T00:09:35","slug":"on-writing-macros-at-work","status":"publish","type":"post","link":"http:\/\/www.allyngibson.com\/?p=1938","title":{"rendered":"On Writing Macros At Work"},"content":{"rendered":"<p>For a variety of reasons, I needed to talk to a colleague of mine at work today.  He&#8217;d needed a document from me yesterday, and I wanted to check and see if that was something that he was going to need on a monthly basis going forward.<\/p>\n<p>Never hurts to check, right?<\/p>\n<p>Well, in the course of the conversation, we got to talking about a series of weekly documents he produces.  &#8220;It&#8217;s the only thing I do on Mondays,&#8221; he said.  &#8220;It takes all day, and it has to be done on Mondays.&#8221;<\/p>\n<p>I&#8217;d never thought to ask before.  &#8220;Tell me, what is it you do?&#8221;<\/p>\n<p>He opened up a Word document.  &#8220;See this?&#8221; he said.  &#8220;I have to go through and I have to delete out this, and delete out that, and it&#8217;s tedious.  Drudge work.&#8221;<\/p>\n<p>I thought for a moment.  &#8220;Can you send me that?  And maybe any written instructions you have?  I think I can write a Word macro to take care of all that.&#8221;<\/p>\n<p>&#8220;Really?&#8221;<\/p>\n<p>I shrugged.  &#8220;Let me see what I can do.&#8221;<\/p>\n<p>He sent me the files.<\/p>\n<p>I opened up the Word document.  I printed off the instructions.<\/p>\n<p>I&#8217;ve written a <i>ton<\/i> of macros for my own personal use at work.  Some of the code I&#8217;d written there, I realized, would need only minor tweaking to perform the necessary surgery on this Word document &mdash; removing codes, deleting certain lines, fixing some broken names.<\/p>\n<p>I started coding.  And in about an hour I had something that <i>worked<\/i>.<\/p>\n<p>It&#8217;s a two-step process.  The first takes the document and &#8220;cleanses&#8221; it of unnecessary data.  Since that file gets used later, a second macro takes the &#8220;cleansed&#8221; document and creates a separate document that has had even <i>more<\/i> data deleted from it.  A &#8220;family friendly&#8221; document, shall we say.<\/p>\n<p>I asked my colleague to come by my cubicle when he had the chance.<\/p>\n<p>I ran the procedure.<\/p>\n<p>He blinked.<\/p>\n<p>&#8220;Oh my god,&#8221; he said.<\/p>\n<p>It took less than a minute.<\/p>\n<p>Doing the same procedure by hand, it took an hour and a half.<\/p>\n<p>It&#8217;s certainly going to take off some of the Monday stress on my colleague.<\/p>\n<p>Sometimes I&#8217;m just too good. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a variety of reasons, I needed to talk to a colleague of mine at work today. He&#8217;d needed a document from me yesterday, and I wanted to check and see if that was something that he was going to need on a monthly basis going forward. Never hurts to check, right? Well, in the<a class=\"more-link\" href=\"http:\/\/www.allyngibson.com\/?p=1938\">Continue reading <span class=\"screen-reader-text\">&#8220;On Writing Macros At Work&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[229],"tags":[426,4124],"class_list":["post-1938","post","type-post","status-publish","format-standard","hentry","category-work","tag-microsoft-word","tag-work","entry"],"_links":{"self":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/1938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1938"}],"version-history":[{"count":0,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/1938\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1938"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}