Category: Uncategorized
Word: Show Me My Property
‘MsgBox (“Value of this property ->” + myProp + “<-")
- wdPropertyAppName
- wdPropertyAuthor
- wdPropertyBytes
- wdPropertyCategory
- wdPropertyCharacters
- wdPropertyCharsWSpaces
- wdPropertyComments
- wdPropertyCompany
- wdPropertyFormat
- wdPropertyHiddenSlides
- wdPropertyHyperlinkBase
- wdPropertyKeywords
- wdPropertyLastAuthor
- wdPropertyLines
- wdPropertyManager
- wdPropertyMMClips
- wdPropertyNotes
- wdPropertyPages
- wdPropertyParas
- wdPropertyRevision
- wdPropertySecurity
- wdPropertySlides
- wdPropertySubject
- wdPropertyTemplate
- wdPropertyTimeCreated
- wdPropertyTimeLastPrinted
- wdPropertyTimeLastSaved
- wdPropertyTitle
- wdPropertyVBATotalEdit
- wdPropertyWords
Dim rngDoc As Range
Dim proDoc As DocumentProperty
Set rngDoc = ActiveDocument.Content
rngDoc.Collapse Direction:=wdCollapseEnd
For Each proDoc In ActiveDocument.BuiltInDocumentProperties
With rngDoc
.InsertParagraphAfter
.InsertAfter proDoc.Name & “= “
On Error Resume Next
.InsertAfter proDoc.Value
End With
Next
End Sub
Back From the Future
Marty McFly: Ah, yeah… Give me – Give me a Tab.
Lou: Tab? I can’t give you a tab unless you order something.
Marty McFly: All right, give me a Pepsi Free.
Lou: You want a Pepsi, PAL, you’re gonna pay for it.
Changing Weekend in Excel Workday
If you live somewhere where the weekend is on Friday and Saturday instead of Saturday and Sunday, here is a hack to the Excel Workday function to calculate the correct dates:
WORKDAY(K5+1,5)-1
Preventing Emails with Blank Subject Lines in Outlook
- Open the Visual Basic Editor (in Outlook, press ALT+F11).
- On the left-hand side of the screen, expand the ‘Project1′ (go into ‘Microsoft Office Outlook Objects’ -> ‘ThisOutlookSession’).
- Double click on ‘ThisOutlookSession’
- Paste the following lines of code in the right-hand pane of the screen:
Save the project (‘File’ -> ‘Save’) and return to Outlook. From now on, the code will be called every time you press the send-button after you composed an email. Outlook will pop up a warning when you try sending an email with an empty subject line.
For Example, That Is…
- i.e. means id est in Latin and “that is” in English
- e.g. means exempli gratia in Latin and “for example” in English
Macros: Moving the Selection
I taught myself how to use macros (through lots of web searching and testing lots of bad code in Word), and therefore, there are some basics that were left out along the way. Today’s post is about one of those missing pieces: moving the selection.
Once something is selected, the selection can be changed by issuing a command with the following parameters:
- Move type
- Move unit
- Count
- Extend
“Move type” is one of MoveLeft/Right/Up/Down. This gives us a direction to use as a reference for the rest of the commands. The move will start with the end of the selection.
“Move unit” specifies the units for the count parameter.
“Count” specifies how many times we repeat the move.
“Extend” can either be wdExtend or wdMove. Using wdMove removes the selection (not the text, just the selection highlighting) and places the cursor at the end of the selection.
Now let’s put it all together. I’ll use the example below to demonstrate some of the possibilities. I have some text where there is a special word (Phlogtastic) that I want to change the first five characters to italics (so that it will be Phlogtastic).
Here is the sample macro:
Sub makeFirstPartofWordItalic()
‘ fix the headings that don’t have italics
For Each myWord In ActiveDocument.Words
If myWord = “Phlogtastic ” Then
myWord.Select
‘Option 1: Using MoveLeft
Selection.MoveLeft Unit:=wdCharacter, Count:=7, Extend:=wdExtend
‘Option 2: Using MoveRight
Selection.MoveRight Unit:=wdCharacter, Count:=-7, Extend:=wdExtend
‘Option 3: Using Combinations
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=5, Extend:=wdExtend
Selection.Font.Italic = True
End If
Next myWord
End Sub
Option 3: Note that in the previous cases we used the wdExtend parameter which changed the what is selected. In this case, we are going to create a whole new selection. First, the move done without the wdExtend parameter so the cursor is placed at the end of the selection and then moved. The move unit is in words instead of characters, so moving to the left by one word give us “|Phlogtastic” with the cursor at the beginning of the word (before the ‘P’). Next, we expand the selection by moving five characters to the right, resulting in “Phlogtastic”.
Happy Moving 🙂
Super Copyrights
Today I changed a term in one of my documents to use a fancy, new term which has a copyright. For some reason (which I’ll ignore for now) when I replaced the term, the copyright symbol was not put into superscript. So, macros to the rescue:
Sub copyrightToSuperscript()
‘
‘ copyrightToSuperscript Macro
‘
‘ Change all copyright symbols to superscript
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Superscript = True
.Subscript = False
End With
With Selection.Find
.Text = “©”
.Replacement.Text = “©”
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
I originally thought that I would need to use the ASCII code for the symbol, but the macro works just fine as written above.
The Future of Publishing
More Bathroom Humor
| I my office we have one bathroom that has two stalls next to each other. The stall on the left has a nice big fan which provides plenty of ventilation. The stall on the right has no ventilation. Now, someone probably complained about the lack of ventilation so they searched long and hard, and consulted with the best bathroom consultants in the country for a solution to the problem. What was the solution? | |
| All of you brilliant thinkers out there probably came up with the same solution: Cut a hole in the wall and stick a fan in it. Now, it blows the stink from one stall to the other!
Suggestion to visitors: Use the stall on the right. |

