| |
PASTING UNFORMATTED TEXT
A MACRO
SOLUTION
Do you get the jitters when you think about writing a
macro? No reason to be intimidated. It's easy. If you have
ten minutes, I can show you how - and this is a macro
you'll use, too.
Here's what I want the macro to do. I want to change the
behavior of the Word paste shortcut key combination,
Ctrl+V, so it pastes just the stuff in the clipboard, and
not the formatting. Here's how:
> Start Word. (Tough one, eh?)
> Bring up Visual Basic for Applications by clicking Tools
| Macro | Macros. Type a good macro name in the box -
say, PasteUnformatted - and click Create.
> Unless somebody (or something) has your "normal" template
locked away, VBA comes to life, and writes a little
program for you that looks something like this:
Sub PasteUnformatted()
'
' PasteUnformatted Macro
' Macro created 10/18/2001 by Phineas T. Farquahrt
'
End Sub
> Immediately before that "End Sub" line, you need to type
one short, sweet line of VBA code. When you're done, the
macro should look like this:
Sub PasteUnformatted()
'
' PasteUnformatted Macro
' Macro created 10/18/2001 by Phineas T. Farquahrt
'
Selection.PasteSpecial DataType:=wdPasteText
End Sub
> You're done with the programming part of the exercise.
(Really!) In VBA, click File | Close and return to
Microsoft Word.
> Now you need to tell Word to run that macro every time
you press Ctrl+V. That's easy, too. Click Tools |
Customize. Make sure "Save in" shows normal.dot and
click
the Keyboard button.
> In the Categories box, pick Macros. In the Macros box,
pick PasteUnformatted. Click inside the Press New
Shortcut Key box and hit Ctrl+V. Click Assign.
> You're done. From that point on, every time you press
Ctrl+V, Word will paste the contents of the clipboard,
and ignore any formatting.
Home |