#1
|
|||
|
|||
Paste-As-Text macro
I regularly need to copy and paste-as-text (rather than pasting formatting/html, etc.). In MS Word, I use the following macro:
Code:
Sub PasteSpecial() Selection.PasteSpecial DataType:=wdPasteText End Sub Any advice would be most appreciated. Paul |
#2
|
|||
|
|||
Hello paulkaye,
please try ActiveCell.PasteSpecial paste:=xlPasteValues Kind regards, Wries |
#3
|
|||
|
|||
I got:
Runtime error '1004': PasteSpecial method of Range class failed I am often copying from outside of Excel - could it be that paste>values is a function only for pasting from copied Excel cells? |
#4
|
|||
|
|||
sorry, I haven't realized you are copying outside excel.
Please try again with this and advise if it is working from your end. Code:
Sub Paste() ActiveCell.PasteSpecial xlPasteAll End Sub Wries |
#5
|
|||
|
|||
Thanks - that worked perfectly, except for one really strange problem. After I paste, undo no longer works. That is, all the 'stored' steps to which I can normally 'undo', disappear. I don't just mean that I can't undo the paste performed by the macro; I mean that all previous steps disappear from the undo list, too!
|
#6
|
|||
|
|||
Seems normal to me. I have never been able to use undo button after running a macro.
There are some links in google regarding this issue. As far as I have read the "undo cache" is cleared after/before macro is used. Try to google for undo macro. I have seen some, but I have no use for them so far. Kind regards, Wries |
#7
|
||||
|
||||
Any running of a macro in Excel clears the Undo stack.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Wow - I've never heard of such a thing. Doesn't happen in Word, so why should it be necessary in Excel? I looked around as you suggested, and I saw the problem described in several places - and no solution. This actually means that I will not use the macro at all - no way I can risk ruining a spreadsheet for such a simple action. Oh well, thanks for your help anyway - I appreciate it.
|
#9
|
||||
|
||||
All Excel versions are the same in that respect, so I imagine it's a design limitation.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
macro, paste, text |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Paste text box onto graph, text disappears | sarasbluegroove | Word | 6 | 12-20-2016 07:22 AM |
A macro that can insert FILENAME, sendkeys CTRL ALT T, paste clipboard, and nextline | kyjac85 | Word VBA | 13 | 09-20-2012 05:00 PM |
Paste Special Unformatted Text | kenwpaul | Office | 2 | 02-25-2011 04:53 PM |
Macro to paste unformatted text | Andacar | Word | 2 | 01-05-2011 09:15 PM |
How to create macro to paste text after style? | Srivas | Word | 0 | 03-16-2010 05:28 AM |