George MacKerron: code blog

GIS, software development, and other snippets

Paste unformatted keyboard shortcut in Office 2008 for Mac

iWork and some other Mac apps provide the keyboard shortcut Apple-Alt-Shift-V for the extremely useful command Edit > Paste and match style. But Office 2008 provides no such equivalent for its equivalent command, Edit > Paste > Unformatted Text > OK. Annoying.

Happily, you can fix this with a strategically named and placed AppleScript. Open /Applications/AppleScript/Script Editor, and paste in the following lines:

tell application "Microsoft Word" 
  paste special (text object of selection) data type paste text
end tell

Save in /Users/YourUserName/Documents/Microsoft User Data/Word Script Menu Items as Paste unformatted\mosV.scpt (the backslashed bit at the end of the filename provides the shortcut). Restart Word and you can now paste without importing extraneous styles with Apple-Alt-Shift-V.

Update

You might also try this alternative approach (via a handy comment elsewhere):

try
  set theClip to Unicode text of (the clipboard as record)
  tell application "Microsoft Word" to tell selection to type text text theClip
end try

This has the advantage of leaving the cursor where you expect, at the end of the pasted text — the original script fragment leaves it at the beginning. And no, type text text is sadly not a typo: that’s really how Word likes to be addressed.

Share

Written by George

May 19th, 2009 at 4:35 pm

Posted in Mac

  • TJJ

    Thanks for the tip. Works great.

  • virusdoc

    Great tip. However, since I ALWAYS paste as unformatted text, I changed the script name to mV.scpt. This now overrides the default behavior of command-V (default to Paste as formatted text) to render all paste commands as unformatted text. In Word, this text will automatically assume the style attributes of the section into which the text is pasted.

    I find the command-alt-shift-v combination awkward, but the command-V is deeply embedded in muscle memory…

    Again, thanks for the tip!

  • Jon

    Works great! Thank you soo much!!

  • I would also like to make it the default behavior, but I’ve never written an apple script before. Can someone give me the steps for doing what virusdoc suggests above?

  • cam

    second script works perfectly with Word. But trying it with Excel 2008 doesnt work. I tried to replace “Microsoft Word” with “Microsoft Excel” but that just gives me errors when saving it to Excel script menu items (syntax error…)

    Anyone can help that would be great, thanks

  • Pingback: Im Scheinwurf » Blog Archive » Unformatiert einfügen()

  • Cam, I also tried to revise the script for Excel. Does anybody know how to do this?

    Also, I modified the filename ending to msV.scpt, eliminating the O so I wouldn’t have to hit the Alt key – Command-Shift-V is so much more natural.

    Usually I use Menu Master to create keyboard shortcuts, so Microsoft’s Malicious Mac Mouse-iness is more or less dead to me – maybe completely now.

    Thank you for providing this script, George.
    You saved me from the painful mouse and menu workflow, which is the ONLY thing I find frustrating about Mac’s Excel 2008. (Though I am still praying for Office for Mac to give us the advanced Conditional Formatting that Excel 2007 Windows introduced – it kicks sooo much nerdy ass.)

    Anyone have solutions to the Excel shortcut or an add-on for conditional formatting?? Hit me up via my website.

  • Just found out how to DO THE SAME IN EXCEL!

    You will find the script here:
    http://www.owczarek.com.pl/blog/2009/11/11/automating-ms-office-for-mac-editing-and-pasting/

    macalicous.

  • chloroplast73

    May you please received thousand thanks for posting such useful scripts for users like me. Simple, efficient and exactly what I was looking for. Thanks again for sharing your skills.

  • Patrick

    Cannot begin to tell you how useful this has been for me. Thank you!

  • Michael

    Works like charm. Thanks a lot!!!

  • Olivier L.

    Thanks a lot! It works, but is it slow for everybody? It takes a full 2 seconds to paste the unformatted content.

  • Thanks–works great.

  • Mat

    Fantastic tip, thank you (I used the alternative version).

    Also, easiest way to get the script in the right place is to go into Word, select the script drop-down menu, select “About this menu …” and then “Open folder.” Now drag/drop your saved script into that folder. For me, I didn’t even have to restart for it to start working.

  • Eric

    Terrific. Just what I needed. Thanks.

  • Tinto

    Does anyone have a script solution for Powerpoint 2008? I have attempted to use the above example for Word 2008 – but sadly it gives me an error on the ‘text text’ portion.

    Thoughts?

  • Kn

    Cheers! that was super helpful!

  • Slim

    Brilliant! An issue which has been annoying me for years is finally solved.

  • Jon

    Thanks you – super helpful.

  • Iye

    Thanks that was super useful. I’ve been looking for this tip forever.

  • Hey, thanks for this! Saves me a ton of time! Well done.

  • Guy

    Like Tinto, I need an Applescript keystroke that will Paste Unformatted in Powerpoint 2008. I have tried various options for Word, replacing “Word” with “PowerPoint”, but get the same error message.

  • Boom

    You are a life-saver!

  • Tom

    Hi, for the dummies amongst us: I have changed it to “Paste unformatted\oV.scpt”. I can live with “Alt-V”, but any chance you beautiful people will tell me how to change it to “Ctrl-V”?

    Tx!

  • Lyle Turner

    I believe character mapping for the modifier keys are:
    c = ctrl,
    o = option/alt,
    s = shift,
    m = command

    “\cV.scpt” should give you the Ctrl=V shortcut.

    So combine at will.

  • Nobody

    Awesome! I’ve been looking all over for a way to do this, but nothing else worked. Thank you!

  • Craig

    Why on earth wouldn’t MS make unformatted the default and make it your choice to paste formatted in the rare instance you would ever want to do that. On my own I figured out how to set paste unformatted using a macro in the previous version, but there is no way I would be able to figure this trick out without help. This is in keeping with trend in our society to make things harder and harder for the end user to fix on their own. I’m not a fan of that.

  • Bob

    George, the script runs fine in the AS editor and when I access the script through the AS menu (the unformatted text is pasted) but when I use the keyboard shortcut the AS menu becomes hi-lighted but WORD locks up…

    Any ideas?

  • Bob

    UPDATE – the second script you posted worked fine for me. I set the shortcut to \csV.scpt

    Thank you. This will change my life. :)

  • RJ

    I am looking for a keyboard shortcut to Paste Special images that are Pictures.

    When I adjust the script to that shown below, replacing Text with Picture, on trying to save the script I get a message saying Syntax error – Expected end of line but found class name.

    Adjusted script:
    tell application “Microsoft Word”
    paste special (text object of selection) data type paste Picture
    end tell

    What do I need to do to adjust the script so it pastes a Picture?

  • Katherine

    Thank you!! This will save me so much time!

  • eNVy

    Another easier way of doing this is just to assign a Keyboard shortcut.

    Under MS Word for Mac 2008 one can go to Tools>Customise Keyboard>Edit – look for EditPasteSpecial and assign anything you want to it. No need to faff around with Scripts etc.
    Simple!

    Why isn’t everyone just using this??

  • Because that only takes you to the Paste Special dialogue box, where you then have to select the paste format and click OK. The keyboard shortcut in the blog post pastes with no further clicks.

  • Mike

    Awesome the (second script) works perfectly! Thank you!

  • Chris

    Used the 2nd example in your post. Works great. Thanks!

  • bb

    As an alternative, this code seems to work fine for Excel 2008:

    tell application “Microsoft Excel”
    activate
    paste special on worksheet active sheet format “Unicode text”
    end tell

    Unicode text is pasted on active worksheet in active cell. I used the \cV option at the end for the scpt file name. No problems.

  • Karlos

    AWESOME.

    That has frustrated me for ages.
    Using the override of command V in this case, as I paste unformatted all the time.

    Thanks so much.

  • Viola

    LOVE it! I’d gotten Keyboard Shortcuts to work partially on my desk Mac, but it was still two steps. Couldn’t get the keyboard short cut to work at all on my laptop.

    This totally does the trick. Thank you! Thank you! Thank you!

    I also went with the mV.srpt. Delightful.

  • Kim

    Thank you so much!!! I’ve been going crazy trying to figure this out! It works!!! Thank you!

  • Lucy

    I too am trying to get this to work in Powerpoint but with no success. I followed the link posted by caneel joyce (http://www.owczarek.com.pl/blog/2009/11/11/automating-ms-office-for-mac-editing-and-pasting/), however no luck. Although the script saved without trouble, my Powerpoint ‘thinks’ for a couple of seconds and that’s it, no actual pasting occurs.

    Anyone got anything else I can try? Thanks in advance.

  • ZoD

    MAN thank you so much for that … really you saved my finger :D and also got me into the search for learning some apple script

    THANK YOU

  • Oh thank you so much for that. It has been driving me i-n-s-a-n-e.

  • Mike

    First script work fine for me (except that the cursor is at the beginning of the text).

    Second one is slow and the copied text get bold, square brackets around it that I don’t know how to get rid of. Does anyone else get those?

    Anyway I learned a lot from this, so many thanks!

    /Mike

  • Ryan

    THANKS!

  • David

    THis is exactly what I have been looking for! Sadly, it does not seem to be working for Word 2011. Anyone know what needs to be changed?

  • Randy

    I have a Macbook Pro but can’t find applescript. Do you need extra coding software to do this?

  • Randy — nope, it’s built in. In 10.6 you need Applications > Utilities > AppleScript Editor. I dimly recall it being elsewhere in previous OS X versions — maybe Applications > AppleScript?

  • Rob

    The second script worked for me! Using Snow Leopard and Word 2008.

  • Keith

    This Office default has annoyed thousands of people needlessly for years. Microsoft never fails to frustrate. Which brain-dead Microsoft person or group is responsible for this nonsense?

  • Thank you George! After finding out Mac Word 2008 doesn’t allow you to create new Macros – Using your Script and @virusdoc’s suggestion for “mV.scpt” has been a big relief.

    Switching back-and-forth between my Mac and Windows just got easier!

    Also be sure to close all current opened Word documents AND “Quit” Word completely to allow the scripts to load properly after re-opening Word.