Archive

Posts Tagged ‘VBA’

Roll Your Own Matrix, Part 2

If my last post bored you, there is no hope for you. I dare say that you should be voting Democrat as you will be living off welfare checks for the rest of your life by ignoring my advice.

If my last post intrigued you, and you said “hey, why don’t I learn a little programming, as a hobby of sorts” – this post is for you.

Let me again sell the merits of VBA, from a coding perspective.

  1. You can “program” with no code at all, or use the Macro Recorder as a testing tool. If you want to do something but don’t know how to code it, use the Macro Recorder to do it first. Or, if you just don’t want to take the time to code, you can use the Macro Recorder for that.
  2. VBA was designed as a teaching language. It’s called “BASIC” for a reason. It’s so easy a caveman can do it, metaphorically speaking.
  3. The same syntax is used for every Office application. Word, Excel, Outlook, PowerPoint, Access, Visio, etc., etc. all use VBA in its standard form. Obviously, certain programming “objects” are different depending on the program (Excel deals with cells while Word uses paragraphs), but the style remains consistent.
  4. Intellisense. Like predictive text for your phone, the VB Editor attempts to divine what you’re trying to do. You don’t have to remember a specific object or property – the Editor will attempt to help you through that. Crucial for those who don’t want to have print-outs of programming vocabulary.
  5. VBA scripts can be automated or called on demand. Say, for instance, that I want a specific format to be applied to a word. Let’s say that every time I type “government,” I want it highlighted in red and black with devil ears on the side. I can have the program do that formatting every time it sees “government,” or I can have that program called at the press of a button. Your call.

If you’re looking to start with VBA for Word, look here for more.

If you’re looking to start with VBA for Excel, look here for more.

If you’re looking to start with VBA for Outlook, look here for more.

If you’re looking to start with PowerPoint or Access, don’t. While they work just the same, PPT and Access are not as easy to code given their nature. Word, Excel or Outlook would be better for first attempts.

Enjoy…

Roll Your Own Matrix

From time to time, it amuses me to extend my prophecies from the general “state of affairs” sort of postings to a style that might be known as “wisdom from the mountains.” I find myself in such an evening tonight.

Below, in referencing the sage analysis of Mr. Rajan, I mused that education will continue to have a disproportionate effect on the job prospects of many Americans as we continue to drift toward a service economy.  I believe that many service workers will benefit from having programming knowledge of any sort. My reasons are as follows:

  1. We are increasingly a computer-based economy. Few (to no) offices are computer-less, and most tasks that were done manually are now keyed into a computer. You know all this, so let’s move on.
  2. Programming demonstrates a control over a computer far beyond that of the average employee. If you and I have equal communication skills, are equally well-liked by our co-workers, have comparable intelligence but I can control my work tool better, who has a stronger set of skills? It’s the difference between using a hammer or using a nail gun, if we have an equal knowledge of architecture.
  3. Programming might just get you out of having to go into the office. Let us say that you demonstrate epic productivity in the office, via well-executed programming skills. Who is better positioned to apply to work from home – you, or your co-worker who always looks like he’s struggling to stay afloat? You, of course. Which leads me to my next point..
  4. Programming can help you eliminate stress. Let us say that you periodically receive an email with invoices from a supplier. And let us say that you always have to save these invoices to a certain folder before processing. What if you could program your email application to just pull the attachments out and save them without you having to deal with it? Wouldn’t that save you, say, 15 seconds an email? If you’re getting 40 of those a week, every week – that’s a lot of seconds saved. Clearly, you can come up with your own ideas here.

The typical stigma is that someone who knows how to program must be a special kind of computer geek who prefers to sit in a lab and not talk to anyone all day. Yet, everyone respects said computer geek because he churns out a fine product and makes all the stuff work around the office. THEREFORE, if you could combine his skill-set with your innate ability to win friends and influence people – well then, you have won yourself a promotion.

“But Prophet!” say thee. “How would I learn to program? I cannot go back to school right now and I don’t have time after work to learn this myself.”

FEAR NOT,” say I. “Learn VBA instead.”

VBA is a programming language built into Word, Excel, PowerPoint, Outlook – the entire Office suite. This language can only be fully utilized by individuals running Windows and MS Office – which I imagine is most of your corporate lives. For the rest of you, sorry. You can learn something else.

VBA stands for “Visual BASIC for Applications.” It was initially designed as a training language for new programmers, but has since been fully integrated into Office as a customization tool. Allow me to get you started..

  1. Open Word or Excel. Type a phrase for some dummy text. Then find your “Macro Editor,” which will be in a different place if you’re using Office 2003 or 2007.
  2. Click Record Macro. Then, do something to the text. Highlight it, bold it, delete it. Go crazy. Then Stop Recording.
  3. Make some more dummy text. Then go to Macros, and run your Macro. BAM. It will repeat the exact same stuff you just recorded, automatically. “HOLY CRAP,” you say. “I JUST PROGRAMMED.”
  4. Then you say “wait, Prophet. I thought programming was all codes and variables and suchlike.” Well, you see, it is. Microsoft just created the code for you.
  5. Hit Alt+F11 on your keyboard, and the VBA Editor will pop up. Then you shall see your mystical “code.” Voila. You have programme.

Granted, these are only the most basic (pun?) examples. Office allows you to create those little automated fragments of code, but you can get into much greater detail if you learn the language. This is an area where I, being a generous man, will gladly start you off on the path. If you wish for further direction in these matters, say it in the comments.

Who knows? Maybe one day, your job will depend on it.