Feeds:
Posts
Comments

Posts Tagged ‘macro’

Oh, what an exciting life I lead. My first post, in the early AM of the first day of the year, and what is the topic? Coding. Woohoo! Happy New Year!

Anyways…

Following a Computer Cock-Up Of Monumental Proportions, which I might or might not expand—or, indeed, expound—upon in a later post, I ended up upgrading from Office 2003 to Office 2010 a couple of weeks back. Anyone who remembers the experience of changing from the menu-based to the ribbon-based interface will, I hope, understand and sympathise with my profound sense of, erm, call it culture shock. Not only that, but I lost not only all the customisations and macros I'd made to Word over the years, but also the back-ups of same, which were on a USB hard-drive which got wiped during the course of the CCUOMP. (It's pronounced "queue-omp.")

(more…)

Read Full Post »

T'other day, I knocked together a macro, for a friend, to number the paragraphs in a Microsoft Word document ("manual" rather than hard-coded numbering, that is):

Sub NumberingParagraphs()

    Dim iParagraphs As Integer
    iParagraphs = ActiveDocument.Paragraphs.Count
    
    Selection.HomeKey unit:=wdStory
     
    Do While iCount < iParagraphs
        iCount = iCount + 1
        Selection.TypeText iCount & ": "
        Selection.MoveDown unit:=wdParagraph
    Loop

End Sub

My mate, being curious about, but not having experience of, the workings of such things, took a look and got the basic idea, but couldn't get his head around why the number of loops is seemingly instructed to be one less than the number of paragraphs. Surely, he said, it should be "less than or equal to," rather than "less than." Well, no. His kid got it straight away, and came up with a lovely semi-analogy; which I now share, in hopes that others who've been puzzled by this oft-seen seeming-paradox might see the light. Let's literally (yet figuratively) walk through the macro…

(more…)

Read Full Post »

A couple of years back, when I first discovered macros, I kinda fell a bit in love with them. In particular I was entranced by the Visual Basic Editor packaged with Microsoft Office for the purpose of editing macros, or even writing them from scratch, bypassing the rather naff macro recorder. Long before I had a clue how to even begin to decipher the inner workings of these magical text-spells, let alone edit one myself, I was happily pillaging the internet for complete projects offered up by those sorcerers who do know how to create conjurations with this Clarkian magic. Like any denizen of Arthur C Clarke's magical kingdom, I may not know how to bind the spirits to a purpose, but when a friendly magician gives me the already-imbued Ring Of Invisibility and tells me the magic word, I can use the fruits of her labour with ease. (more…)

Read Full Post »

Ever since I posted an article on Microsoft Word macros, I've had a steady-ish stream of searchers landing on the page, looking for how to enclose paragraphs in <p> … </p> tags using Word's Find/Replace function. I mentioned in passing, in that post, that it can be done but I didn't expand on it. So here's how to do that.

(more…)

Read Full Post »

[In which I moan about the abysmal macro-recorder in M/S Office, and show how to create and edit a macro.]

I finished my previous article with a comment that I've long wanted to have a bit of a whinge about M/S Word's macro recorder. Before I do that, though, I suppose I'd better explain what a macro recorder is. Indeed, what a macro is, given the number of people I've run into who seem have no idea that such things exist. Not to mention the number who start to back away slowly from my apparent geekism if I actually start discussing the ins and outs of them!

(more…)

Read Full Post »