Word for Mac 2011 Paste Special/Keep Txt Only

Discussion in 'Mac Apps and Mac App Store' started by sunsnewmac, Mar 14, 2011.

  1. sunsnewmac macrumors 6502

    sunsnewmac

    Joined:
    Mar 3, 2007
    #1
    I've got a question about Word for Mac 2011 (which I'm using on my new MacBook Air). If anyone can help me resolve this I'd be really happy!

    I have figured out how to make a keyboard shortcut to Paste Special - Match Destination formatting. That is easy to do because under the Customize keyboard --> Edit options it's right there.

    However, what I *really* want to do is to have the keyboard shortcut point to Paste Special - Keep Text Only. That option is not available from the standard Customize Keyboard menu options (at least as far as I can see).

    I did a Google search and the only thing I came up with was a suggestion to create a Macro, which I did but the suggested macro did not work. The suggestion was given for Word for Windows, and I am not sure if that makes a difference for Macros but in any case it didn't work. I'd prefer not to deal with Macros anyway!

    Can anyone help me with this? It would tremendously help me!
     
  2. mactitude, Aug 11, 2012
    Last edited: Aug 11, 2012

    mactitude macrumors newbie

    mactitude

    Joined:
    Aug 11, 2012
    Location:
    Belgium
    #2
    Re: Word for Mac 2011 Paste Special/Keep Txt Only

    I fear that the only way to do this is indeed by using a macro. But it's not as hard as it sounds, honest!

    1. First create your macro:

    1.1 In Word, click Tools > Macro > Macros...
    1.2 in the window that appears, enter "PasteAsText" (without the quotation marks) as the macro name
    1.3 Click Create
    1.4 The Visual Basic Editor opens
    1.5 At the point where the cursor is blinking (on the line above the line that says "End Sub"), paste in the following code:

    'if no window open, warn the user
    If Windows.Count < 1 Then
    MsgBox "PasteAsText can't paste as text, because there is no document open. Open a document and try again.", vbOKOnly, "PasteAsText"
    GoTo terminate
    End If
    'if window open but protected, warn the user
    If ActiveDocument.ProtectionType <> wdNoProtection Then
    MsgBox "PasteAsText can't paste as text, because the document is protected. Unprotect the document and try again.", vbOKOnly, "PasteAsText"
    GoTo terminate
    End If
    'if nothing on clipboard, warn the user
    If CommandBars.FindControl(ID:=22).Enabled = False Then
    MsgBox "PasteAsText can't paste as text, because there is nothing on the Clipboard. Copy some text and try again.", vbOKOnly, "PasteAsText"
    GoTo terminate
    End If
    'if something on clipboard, but can't be pasted as text (e.g. a picture), warn the user, otherwise just paste it as text
    On Error GoTo CannotPaste
    Selection.PasteSpecial DataType:=wdPasteText
    GoTo terminate
    CannotPaste:
    MsgBox "PasteAsText can't paste as text, because the Clipboard contains an item that cannot be pasted as text. Copy some text and try again.", vbOKOnly, "PasteAsText"
    terminate:

    1.6 In the Word menu of the Visual Basic Editor, click "Close and Return to Microsoft Word"

    OK, that's your macro made. Its name is PasteAsText. Now let's assign PasteAsText to a keyboard shortcut.

    2. Assign PasteAsText to a keyboard shortcut:

    2.1 In Word, click Tools > Customize Keyboard...
    2.2 in the window that appears, scroll down in the top left box until you can see "Macros" and then click "Macros"
    2.3 The box on the right will update to show all the macros that are available. Click PasteAsText (it will be the only item in the list if you've never made a macro before)
    2.4 Click in the Press new keyboard shortcut field and then press your desired keyboard combination (I suggest Control+Shift+A as it can easily be pressed using the fingers of the left hand only, you can remember it quite easily for the capital A in PasteAsText, and its default assignment of ShowAllHeadings is not terribly useful), then click Assign and then click OK

    These modifications are held in the Normal template. So for the final finishing touch, save the Normal template.

    3. Save the Normal template:

    3.1 In Word, click Tools > Macro > Visual Basic Editor
    3.2 In the File menu of the Visual Basic Editor, click "Save Normal.dotm"
    3.3 In the Word menu of the Visual Basic Editor, click "Close and Return to Microsoft Word"

    You're done! To test that it works, open a Word doc that contains some text with some nice formatting such as bold or an extra-large font size. Select that text and press Command+C to copy it. Then make a new document (Command+N) and press Command+V. The text is pasted with all its formatting intact. Now make another new document, but this time, press Control+Shift+A. The text is pasted... but as plain text only, with no formatting!
     
  3. Robsimkins macrumors newbie

    Joined:
    Dec 6, 2012
    #3
    Brilliant

    Great job, thanks so much for the post!
     
  4. pleury macrumors newbie

    Joined:
    Oct 26, 2007
  5. Gregg2 macrumors 603

    Joined:
    May 22, 2008
    Location:
    Milwaukee, WI
    #5
    So simple, even I could do it!
     
  6. soontorb macrumors newbie

    Joined:
    Nov 9, 2013
    #6
    Thank you!

    Dude, I just wanna tell you that I register to the forum just to say thank you to your piece of code which mean a lot to my life!:)
     
  7. rferns macrumors newbie

    Joined:
    Nov 18, 2013
    #7
    Thanks mactitude

    Your response helpful. Thanks for your help.
     
  8. canne macrumors newbie

    Joined:
    Dec 10, 2013
    #8
    Thank you

    I also registered just to say thank you. This helped SO much! :)
     
  9. doonouno macrumors newbie

    Joined:
    Dec 17, 2013
    Location:
    Lexington
    #9
    Thank you mactitude

    Thank you!!!! This is such a big help. THANK YOU. :D
     
  10. mcshockey macrumors newbie

    Joined:
    Feb 26, 2014
    #10
    Match Destination Format for Excel Mac 2011?

    Can you please send me the macro code and instructions for Match Destination Format for Excel Mac 2011?

    Thank you,

    Michael
     
  11. rumorviewer macrumors newbie

    Joined:
    Mar 2, 2014
    #11
    Thank you

    I also registered just to say thank you. This is a big help.
     
  12. mactitude macrumors newbie

    mactitude

    Joined:
    Aug 11, 2012
    Location:
    Belgium
    #12
    Word for Mac 2011 Paste Special/Keep Txt Only

    Thank you all for your wonderful comments. I am very pleased that my macro has turned out to be helpful. mcshockey I have to confess that I don't know how to do this in Excel unfortunately.
     
  13. guppyg macrumors newbie

    Joined:
    Mar 23, 2014
    #13
    I never knew it could be so simple!

    Thank you so much for this post. I have resisted macros for years, and you somehow made me give it a go.

    #registeredtosaythankyou
     
  14. MichelleKenobi macrumors newbie

    Joined:
    Apr 4, 2014
    #14
    Thanks!

    I just got a MacBook for work and this will save me a lot of time. Appreciate it. :cool:
     
  15. Chris1969 macrumors newbie

    Joined:
    Jul 24, 2014
    #15
    Lost Footnotes

    Dear mactitude,

    Many thanks for your macro. Unfortunately, when I use it any footnotes that I have are lost! Is it possible to paste unformatted text in Word for Mac 2011 which preserves footnotes?

    With many thanks,

    Chris1969
     
  16. mactitude macrumors newbie

    mactitude

    Joined:
    Aug 11, 2012
    Location:
    Belgium
    #16
    Word for Mac 2011 Paste Special/Keep Txt Only

    Once again thank you all and I am glad my macro is useful. Chris1969 plain text unfortunately doesn't support footnote markers (or any type of field) so if you paste unformatted, the footnote marker gets pasted as a space. The only (clumsy) workaround I currently know is to paste the footnote marker into the appropriate place in the unformatted text using regular copy and paste, and then manually touch up its formatting and delete that extraneous space. I don't know of any way to paste unformatted in Word 2011 while preserving footnotes I'm afraid :(
     
  17. Chris1969 macrumors newbie

    Joined:
    Jul 24, 2014
    #17
    Hi mactitude,

    Many thanks for your reply. I'll just have to do it the long way round I guess...

    Best,

    Chris1969
     
  18. thankyou12 macrumors newbie

    Joined:
    Mar 31, 2015
    #18
    Thank you

    Hey I just registered in 2015 lol, just to say thank you for this. You have saved me a lot of time in the future and i genuinely appreciate it.

    Thank you again.
     
  19. mactitude macrumors newbie

    mactitude

    Joined:
    Aug 11, 2012
    Location:
    Belgium
    #19
    Thank you thankyou12 and I am very happy to read that my macro is useful to you! :)
     
  20. deenado macrumors newbie

    Joined:
    Aug 19, 2015
    #20
    This makes my life SO MUCH EASIER!!!!


    Thank you, thank you, thank you, thank you, thank you, THANK YOU!!!
     
  21. jphd87, Oct 23, 2015
    Last edited: Oct 23, 2015

    jphd87 macrumors newbie

    Joined:
    Oct 23, 2015
    #21
    I love this macro and have been using it for years! Has anyone successfully used this macro for Office 2016? I tried to add it but was not successful.

    When I try using this macro, I get this error:

    Run-time error '91':
    Object variable or With block variable not set
     
  22. keeng4292 macrumors newbie

    keeng4292

    Joined:
    Jun 30, 2016
    Location:
    Abu Dhabi City
    #22
    I presume it's at the 'if nothing on clipboard, warn the user section when you debug...
    Just comment it out with the single quote.
    I couldn't find a proper reference on the usage of FindControl on Technet.
    Aaand the code works as it should. :)

    'if nothing on clipboard, warn the user
    'If CommandBars(Edit).FindControl(ID:=22).Enabled = False Then
    'MsgBox "PasteAsText can't paste as text, because there is nothing on the Clipboard. Copy some text and try again.", vbOKOnly, "PasteAsText"
    'GoTo terminate
    'End If
     
  23. mpainesyd macrumors 6502

    mpainesyd

    Joined:
    Nov 29, 2008
    Location:
    Sydney, Australia
    #23
    There is a great OSX app called No Formatting that allows you to just copy and paste plain text. It can be turned on and off viaa the menu bar.
     
  24. mactitude macrumors newbie

    mactitude

    Joined:
    Aug 11, 2012
    Location:
    Belgium
    #24
    Thank you for your reply keeng4292 and I'm sorry jphd87 that it didn't work in Word 2016. It seems that MS has changed or perhaps even deleted the CommandBars code in Word 2016. Please do as keeng4292 suggests and comment out the 'if nothing on clipboard, warn the user section. To do so, place an a apostrophe at the start of each line in the section as keeng4292 demonstrates. Just to repeat keeng4292's excellent example, like this:

    'if nothing on clipboard, warn the user
    'If CommandBars.FindControl(ID:=22).Enabled = False Then
    'MsgBox "PasteAsText can't paste as text, because there is nothing on the Clipboard. Copy some text and try again.", vbOKOnly, "PasteAsText"
    'GoTo terminate
    'End If

    Then the macro will work again. You just won't get a warning any more if there's nothing on the clipboard but I think we can live with that :)

    Thank you all for your comments and thank you in particular keeng4292 for your excellent feedback which is greatly appreciated. mpainesyd, that seems like a much more sustainable solution than a macro and I will look into it!
     
  25. zcrag29 macrumors newbie

    Joined:
    Sep 7, 2016
    #25
    I also created an account to say: thank you for this awesome macro!
     

Share This Page