Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sunsnewmac

macrumors 6502
Original poster
Mar 3, 2007
263
0
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!
 
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!
 
Last edited:
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!

So simple, even I could do it!
 
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!:)
 
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
 
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.
 
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
 
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
 
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 :(
 
Hi mactitude,

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

Best,

Chris1969
 
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.
 
This makes my life SO MUCH EASIER!!!!


Thank you, thank you, thank you, thank you, thank you, THANK YOU!!!
 
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
 
Last edited:
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

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
 
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!
 
  • Like
Reactions: jknistrum
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.