Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
Macro won't work...
Hi. I following the steps to create a macro to paste unformatted text. I
start the recorder, go to Edit, Paste Special and select Unformatted Text. I stop the recorder and save the macro in Normal.dot. However, every time I run it I still get formatted text. Here's the Visual Basic code: Sub PasteSpec() ' ' PasteSpec Macro ' Macro recorded 8/29/2007 by me ' Selection.PasteAndFormat (wdPasteDefault) End Sub What am I doing wrong? Thanks silas |
#2
Posted to microsoft.public.word.newusers
|
|||
|
|||
Macro won't work...
(wdpastedefault) picks up the formatting of the source. You can change the
code to: Sub PasteSpec() Selection.PasteAndFormat(wdFormatPlainText) End Sub -- Best regards, Harvey "silas" wrote: Hi. I following the steps to create a macro to paste unformatted text. I start the recorder, go to Edit, Paste Special and select Unformatted Text. I stop the recorder and save the macro in Normal.dot. However, every time I run it I still get formatted text. Here's the Visual Basic code: Sub PasteSpec() ' ' PasteSpec Macro ' Macro recorded 8/29/2007 by me ' Selection.PasteAndFormat (wdPasteDefault) End Sub What am I doing wrong? Thanks silas |
#3
Posted to microsoft.public.word.newusers
|
|||
|
|||
Macro won't work...
Thanks Harvey, that code works.
I still don't understand why the steps I followed created a macro to paste source formatting when I specifically selected Paste Special Unformatted Text. Could this be the result of a virus? silas "Harvey" wrote in message ... (wdpastedefault) picks up the formatting of the source. You can change the code to: Sub PasteSpec() Selection.PasteAndFormat(wdFormatPlainText) End Sub -- Best regards, Harvey "silas" wrote: Hi. I following the steps to create a macro to paste unformatted text. I start the recorder, go to Edit, Paste Special and select Unformatted Text. I stop the recorder and save the macro in Normal.dot. However, every time I run it I still get formatted text. Here's the Visual Basic code: Sub PasteSpec() ' ' PasteSpec Macro ' Macro recorded 8/29/2007 by me ' Selection.PasteAndFormat (wdPasteDefault) End Sub What am I doing wrong? Thanks silas |
#4
Posted to microsoft.public.word.newusers
|
|||
|
|||
Macro won't work...
Macro recorder doesn't alway generate the best possible code so sometimes we
to to combine the recorded code with our experence and programming knowledge to produce the best code. In your example we can use the following code which uses pastespecial method instead of pasteAndFormat method Sub PasteSpec() Selection.PasteSpecial datatype:=wdPasteText End Sub so the short answer to your question. No , thsi behavor is not caused by a virus, as i said before althoug macrorecorder is an extreamly valuebale tool in our hands but we must remember it's not 100% reliable all the times! -- Best regards, Harvey "silas" wrote: Thanks Harvey, that code works. I still don't understand why the steps I followed created a macro to paste source formatting when I specifically selected Paste Special Unformatted Text. Could this be the result of a virus? silas "Harvey" wrote in message ... (wdpastedefault) picks up the formatting of the source. You can change the code to: Sub PasteSpec() Selection.PasteAndFormat(wdFormatPlainText) End Sub -- Best regards, Harvey "silas" wrote: Hi. I following the steps to create a macro to paste unformatted text. I start the recorder, go to Edit, Paste Special and select Unformatted Text. I stop the recorder and save the macro in Normal.dot. However, every time I run it I still get formatted text. Here's the Visual Basic code: Sub PasteSpec() ' ' PasteSpec Macro ' Macro recorded 8/29/2007 by me ' Selection.PasteAndFormat (wdPasteDefault) End Sub What am I doing wrong? Thanks silas |
#5
Posted to microsoft.public.word.newusers
|
|||
|
|||
Macro won't work...
On Wed, 29 Aug 2007 14:49:34 -0500, "silas"
wrote: Hi. I following the steps to create a macro to paste unformatted text. I start the recorder, go to Edit, Paste Special and select Unformatted Text. I stop the recorder and save the macro in Normal.dot. However, every time I run it I still get formatted text. Here's the Visual Basic code: Sub PasteSpec() ' ' PasteSpec Macro ' Macro recorded 8/29/2007 by me ' Selection.PasteAndFormat (wdPasteDefault) End Sub What am I doing wrong? Thanks silas I know this post will probably never get read since this is so long ago, but I have run into the exact same thing with Word 2003. Word 2000 and below worked fine. It must be one of those infamous MS bugs they tend to do a lot of the time, then never fix. |
#6
Posted to microsoft.public.word.newusers
|
|||
|
|||
Macro won't work...
You are correct: it doesn't work. One of the problems with the Macro
Recorder is that often recorded macros are full of bloated bumpf and just don't work. Even this simple Paste as Unformatted Text you tried to record is defeated! (Note that I used this very same macro to the Word Developers to illustrate the failings of the macro recorder: great idea but if it cannot record one simple command, it is in need of an overhaul.) All you need to do is use this in your macro: Selection.PasteSpecial DataType:=wdPasteText -- Terry Farrell - MS Word MVP "Jesse" wrote in message ... On Wed, 29 Aug 2007 14:49:34 -0500, "silas" wrote: Hi. I following the steps to create a macro to paste unformatted text. I start the recorder, go to Edit, Paste Special and select Unformatted Text. I stop the recorder and save the macro in Normal.dot. However, every time I run it I still get formatted text. Here's the Visual Basic code: Sub PasteSpec() ' ' PasteSpec Macro ' Macro recorded 8/29/2007 by me ' Selection.PasteAndFormat (wdPasteDefault) End Sub What am I doing wrong? Thanks silas I know this post will probably never get read since this is so long ago, but I have run into the exact same thing with Word 2003. Word 2000 and below worked fine. It must be one of those infamous MS bugs they tend to do a lot of the time, then never fix. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Getting a Macro to Work Right | Microsoft Word Help | |||
Simple macro used to work...? | Microsoft Word Help | |||
Can't get macro to work in 1 document but does in others | Microsoft Word Help | |||
Macro doesn't work | Microsoft Word Help | |||
Macro that won't work | Microsoft Word Help |