Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2011, 11:33 AM
Andacar Andacar is offline Macro to paste unformatted text Windows 7 64bit Macro to paste unformatted text Office 2007
Novice
Macro to paste unformatted text
 
Join Date: Jan 2011
Location: Albuquerque
Posts: 11
Andacar is on a distinguished road
Default Macro to paste unformatted text

Hi folks, nice to be here. I'm new to the forum but I've been using Word for quite a while. This is a stumper though, since it's a scripting issue. I'm trying to make a macro that pastes unformatted text. I often have to paste something into a document from another source that has a lot of formatting I want to get rid of. It’s a bit cumbersome to go to Home > Paste > Paste Special, etc. every time. I’ve tried creating a macro to do this but it always pastes the formatted text instead. Am I missing a step?



Thanks,

Andacar
Reply With Quote
  #2  
Old 01-05-2011, 01:40 PM
macropod's Avatar
macropod macropod is offline Macro to paste unformatted text Windows 7 32bit Macro to paste unformatted text Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,379
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Andacar,

Without seeing your code, it's hard to say what you might be doing wrong. However, there is a simpler way: simply go to Word Options > Advanced > Cut, Copy & Paste and set the 'Pasting from other programs' parameter to 'Match destination formatting'.

For a macro solution, try:
Code:
Sub PasteUnformattedText()
' The next line is in case there's nothing in the Clipboard
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteText
End Sub
You might want to add this to a keyboard shortcut.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-05-2011, 09:15 PM
Andacar Andacar is offline Macro to paste unformatted text Windows 7 64bit Macro to paste unformatted text Office 2007
Novice
Macro to paste unformatted text
 
Join Date: Jan 2011
Location: Albuquerque
Posts: 11
Andacar is on a distinguished road
Default

Ah, I see. I was just running the macro recorder and selecting the option for unformatted text. But now that I look at the script I can see it just used the default formatting. Thanks.

Andacar
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create macro to paste text after style? Srivas Word 0 03-16-2010 05:28 AM
Selected text and logo in one macro marijke Word VBA 0 08-24-2009 07:01 AM
Macro to paste unformatted text Textbox & Edit Paste text MikeWM Word VBA 1 08-20-2009 06:21 PM
Macro to paste unformatted text Strip lf/cr from text p3aul Word 9 08-18-2009 12:42 AM
Macro to paste unformatted text paste formated text from Word to only one Excel cell heron Word 1 12-06-2005 02:37 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft