Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard Shortcut - Paste Unformatted Text in MS Word
#1
Lightbulb 
Copying and pasting text from a web page into an MS Word document can be more trouble than it’s worth. We’ve all experienced it at least once. Changing the font, changing its size, changing its color, and changing other formatting are the usual steps involved. What if you could paste text with a macro that gets rid of all that unnecessary formatting? The ‘Paste Special’ command in MS Word has an option for this, but it takes several steps. With this little script, you can do it in one.

Need help creating a keyboard shortcut with ShortKeeper using the following AutoHotkey code? This 5-minute tutorial will help!
Critical
if WinActive("ahk_class OpusApp")
{
  ControlGet, hwnd, hwnd, , _WwG1, A
  if DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hwnd, "UInt", 0xFFFFFFF0, "Ptr", -VarSetCapacity(IID,16)+NumPut(0x46000000000000C0, NumPut(132096, IID, "Int64"), "Int64"), "Ptr*", pacc) = 0
    WordApp := ComObject(9, pacc, 1).Application
  WordApp.Selection.PasteSpecial(,,,,2)
}
else
  MsgBox 0x40040, ShortKeeper, There is no Word document window active.

The script will paste the text if the Word document is the active window and is not busy (e.g. selecting a command).

This script is optimized to be used with ShortKeeper. As such, there is no exception handling, no “Return” at the end, and variable(s) don’t need to be cleared. ShortKeeper does all of this automatically. Just copy/paste the code in the PARAM field in ShortKeeper, set your hotkey, save, and you’re ready to use your new keyboard shortcut.
Enterpad: For those who need more than a few shortcuts.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)