Tuesday, June 15, 2010

What is a Lexophile?

1. lexophile - A lover of cryptic words

For those of you who like punny lists:

1. A bicycle can't stand alone; it is two tired.
2. A will is a dead giveaway.
3. Time flies like an arrow; fruit flies like a banana.
4. A backward poet writes inverse.
5. In a democracy it's your vote that counts; in feudalism, it's your Count that votes.
6. A chicken crossing the road: poultry in motion.
7. If you don't pay your exorcist you can get repossessed.
8. With her marriage she got a new name and a dress.
9. Show me a piano falling down a mine shaft and I'll show you A-flat miner.
10. When a clock is hungry it goes back four seconds.

Wednesday, June 2, 2010

Empty Nest(ed) Tables

I had a large document with many, many tables.  I needed to make sure that none of the tables contained any sub-tables.  Macros to the rescue!

Sub removeNestedTables()
'
' removeNestedTables Macro
'
'
    Dim myTable As Table
    Dim subTable As Table
   
    Dim ttCell As Word.Cell
   
    For Each myTable In ActiveDocument.Tables
        For Each ttCell In myTable.Range.Cells
            If ttCell.Tables.Count > 0 Then
                For Each subTable In ttCell.Tables
                    subTable.ConvertToText Separator:=", "
                Next subTable
            End If
        Next ttCell
    Next myTable
End Sub

Sunday, May 30, 2010

The Incredible Shrinking Sentence

The Cannonball Run (1981)
He's my shrink. He was committed yesterday. 

If you have a block of code with long lines that you quote in a document, the long lines can wrap around to the next line which looks really bad and makes the code harder to understand.  To fix this problem, we start with a macro found over at WordTips and add a conditional statement so that it only is executed for a certain style (in this case Code Box). The macro reduces the font by ChangeSize and then checks if the paragraph fits on one line. It then repeats this process until it fits on one line.

Sub forceParaOneLine()
    Dim objPara As Paragraph
    Const ChangeSize = 0.5
   
    For Each objPara In ActiveDocument.Paragraphs
        If objPara.Style = ActiveDocument.Styles("Code Box") Then
            With objPara.Range
                While .Information(
wdFirstCharacterLineNumber) <> .Characters(Len(.Text)).Information(wdFirstCharacterLineNumber)
                    .Font.Size = .Font.Size - ChangeSize
                Wend
            End With
        End If
    Next objPara
               
End Sub

Note that if you have really long lines, this will reduce the font so that it is impossible to read.  To avoid this, I suggest using 2 styles in your document: one for code that can be shrunk, and one that is not shrunk.

[source WordTips]

Wednesday, May 26, 2010

Gmail: Going Label Crazy

Marion: [laughs] What is this stuff, Rene?
Belloq: [laughing as well] I grew up on this. It's my family label.  

This morning I noticed that you can apply custom colors to labels in Gmail. I have used labels in the past, but the labels didn't really stand out which reduced their usefulness.  With custom labels you can easily differentiate all the emails in your Inbox (work emails in one color, mailing list emails in another color, etc.)

Here's how to use the custom colors. First, create labels and filers.
  1. Create a label. See instructions from Google Help.
  2. Create a filter to apply the label. See instructions from Google Help.
Now we need to apply custom colors to the labels. Click the little arrow next to the label that you want to change:

 When you click the arrow, you get a popup window like this one:
The color choices were a little too dark for my taste.  When I tried them, it was hard to see the text next to them because of the contrast.  You can click on Add custom color and choose a background and text color.

Now all your labels look just the way that you want them.

Happy labeling :)

Sunday, May 16, 2010

Selecting a Text Block

I just came across the shortcut of the year for MS Word over at TechRepublic.  Normally, when selecting text, you select it in a continuous line.  You can expand the selection forwards or backwards.

But, did you know that you can select a text block?  This is one of the powerful features of Vim for those of you who have used Unix computers.

Just hold the ALT key while you click.

For example, if I have the following text:

REM First  line
REM Second line
REM Third  line

You can hold the ALT key and then select the first three letters of each sentence:


REM First  line
REM Second line
REM Third  line

You can also cut and paste a block of text. In the above example, one could cut the selection and then paste it in the middle of the first line, resulting in:


 First REM line
 SecondREM line
 Third REM line

Note that selection of text blocks does not work inside of tables.

[Source TechRepublic]