Reply
 
Thread Tools Display Modes
  #1   Report Post  
ray
 
Posts: n/a
Default How can I make a shortcut or macro to paste text only format?

When I copy from a web page, and do a regular paste to Word, Word has an
error and closes. I need to use "paste special" as text. I tried to record a
macro to paste as unformated text, but it didn't work. How can I write visual
basic macro to do this?
  #2   Report Post  
Chris@PDX
 
Posts: n/a
Default

This one has worked for me:

Sub PasteSpecial()

Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False

End Sub

I then assigned it to a keyboard shortcut to call it up easily.

I actually got this by recording it as a macro, but there may have been
something about the web page that interfered with your attempt to do so. You
may want to change or eliminate some of the optional statements (e.g.,
"DisplayAsIcon:"); they came in recording the macro.

"ray" wrote:

When I copy from a web page, and do a regular paste to Word, Word has an
error and closes. I need to use "paste special" as text. I tried to record a
macro to paste as unformated text, but it didn't work. How can I write visual
basic macro to do this?

  #3   Report Post  
Chris@PDX
 
Posts: n/a
Default

Actually, all of the optional statements specify default conditions, so you
could just shorten this to:

Sub PasteSpecial()
Selection.PasteSpecial
End Sub

"Chris@PDX" wrote:

This one has worked for me:

Sub PasteSpecial()

Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False

End Sub

I then assigned it to a keyboard shortcut to call it up easily.

I actually got this by recording it as a macro, but there may have been
something about the web page that interfered with your attempt to do so. You
may want to change or eliminate some of the optional statements (e.g.,
"DisplayAsIcon:"); they came in recording the macro.

"ray" wrote:

When I copy from a web page, and do a regular paste to Word, Word has an
error and closes. I need to use "paste special" as text. I tried to record a
macro to paste as unformated text, but it didn't work. How can I write visual
basic macro to do this?

  #4   Report Post  
Jezebel
 
Posts: n/a
Default

The default datatype depends on what's actually in the clipboard at the
time, so you need to specify text if that's what you want the macro to do --

selection.PasteSpecial datatype:=wdPasteText



"Chris@PDX" wrote in message
...
Actually, all of the optional statements specify default conditions, so
you
could just shorten this to:

Sub PasteSpecial()
Selection.PasteSpecial
End Sub

"Chris@PDX" wrote:

This one has worked for me:

Sub PasteSpecial()

Selection.PasteSpecial Link:=False, DataType:=wdPasteText,
Placement:= _
wdInLine, DisplayAsIcon:=False

End Sub

I then assigned it to a keyboard shortcut to call it up easily.

I actually got this by recording it as a macro, but there may have been
something about the web page that interfered with your attempt to do so.
You
may want to change or eliminate some of the optional statements (e.g.,
"DisplayAsIcon:"); they came in recording the macro.

"ray" wrote:

When I copy from a web page, and do a regular paste to Word, Word has
an
error and closes. I need to use "paste special" as text. I tried to
record a
macro to paste as unformated text, but it didn't work. How can I write
visual
basic macro to do this?



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
How to highlight text and paste new text in it's place? Ottoman Microsoft Word Help 2 August 4th 05 05:22 AM
End/FootNote text style Shaun Page Layout 4 July 5th 05 04:36 PM
How to paste text which looks like I'm typing? GeorgeWeir40 Microsoft Word Help 2 February 15th 05 04:30 AM
How to paste text which looks like I'm typing? GeorgeWeir40 Microsoft Word Help 1 February 14th 05 07:36 PM
I cannot cut and paste text from word to another applicarion Richiev4 Microsoft Word Help 1 November 25th 04 08:57 PM


All times are GMT +1. The time now is 04:42 AM.

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"