Sunday, March 22, 2009

Macro of the Day (MOTD): Keybord Shortcut For Envelope Printing

I do a lot of envelope printing in my job and I use Word's Envelope Wizard to do most of my envelope printing. I don't know why they have a whole wizard for this though. I would prefer if I could simply highlight the person's address in the letter I was drafting, type a shortcut, and have it print. So, I created a macro. Type Alt + F11 to open the Visual Basic editor. I would put this code in the Normal template. The Normal template is the basis for all Word documents. By putting code there, it will run in any document you are using.

In the Project window on the left side of the Visual Basic editor, open up the Normal tab and the Microsoft Word Objects tab under that. Double click on the ThisDocument icon. Paste the following code in.

Sub PrintEnvelope()
'
' PrintEnvelope Macro
' Macro recorded 3/10/2009 by Michael Shubeck
'
ActiveDocument.Envelope.PrintOut ExtractAddress:=False, OmitReturnAddress _
:=True, PrintBarCode:=False, PrintFIMA:=False, Height:=InchesToPoints( _
4.13), Width:=InchesToPoints(9.5), Address:=Selection.Text, AutoText _
:="ToolsCreateLabels3", ReturnAddress:= _
"The Law Offices of Gregory A. Yates", ReturnAutoText:= _
"ToolsCreateLabels2", AddressFromLeft:=wdAutoPosition, AddressFromTop:= _
wdAutoPosition, ReturnAddressFromLeft:=wdAutoPosition, _
ReturnAddressFromTop:=wdAutoPosition, DefaultOrientation:=wdLeftLandscape _
, DefaultFaceUp:=False, PrintEPostage:=False
End Sub

Now lets hook the macro up to a keyboard shortcut. In Word 2007, click on the Office Button Then click on Word Options at the bottom of the menu that pops out. Then hit the Customize tab. Finally, at the bottom of the Customize window, hit the customize keyboard shortcuts button. In the Categories box, scroll down to Macros. Then, in the Macros box, select our PrintEnvelope macro. Now, click in the Press New Shortcut Key box. Type the key combination that you want to assign to the macro. If the key combination is already used it, the window will show text that says "Currently assigned to." Usually I just replace what was assigned by the Microsoft people because they have shortcuts for features I will never use. Finally, hit the Assign button (don't forget this - I do all the time).


Now you can highlight a person's address in your document, use your shortcut, and the envelope will print.

As a final note, watch out where the envelpe prints if you have multiple printers installed. The envelope will print to the printer listed in the print menu.

1 comment:

  1. Thanks for sharing such an informative posts so keep it up man!! EDDM PRINTING

    ReplyDelete