Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
silas[_2_] silas[_2_] is offline
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Harvey Harvey is offline
external usenet poster
 
Posts: 131
Default 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   Report Post  
Posted to microsoft.public.word.newusers
silas[_2_] silas[_2_] is offline
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Harvey Harvey is offline
external usenet poster
 
Posts: 131
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Jesse[_4_] Jesse[_4_] is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.word.newusers
Terry Farrell[_2_] Terry Farrell[_2_] is offline
external usenet poster
 
Posts: 229
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a Macro to Work Right Joe McGuire Microsoft Word Help 4 January 31st 07 07:25 AM
Simple macro used to work...? Kenneth Microsoft Word Help 19 October 1st 06 09:26 AM
Can't get macro to work in 1 document but does in others Erinshell Microsoft Word Help 10 November 1st 05 09:29 PM
Macro doesn't work Anna Microsoft Word Help 9 October 17th 05 10:25 PM
Macro that won't work Danker Schaareman Microsoft Word Help 1 September 30th 05 04:42 AM


All times are GMT +1. The time now is 07:51 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"