'Copy & Paste Without Formatting' Macro runtime error 1004

lipmesiter

New Member
Joined
Dec 12, 2010
Messages
5
Hi and thanks for all your help in advance.

I created a macro with CTRL-V shortcut to copy text from websites and PDF's and paste them directly into Excel without formatting - just as text. Here is the VBA script and it works perfectly;


Sub PasteWOFormatting()
'
' PasteWOFormatting Macro
' Press Ctrl+v to paste text into a cell without any formatting
'
' Keyboard Shortcut: Ctrl+v
'
ActiveSheet.PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:= _
False
End Sub


HOWEVER, whenever I copy and then try to paste something within Excel, I get;
'Runtime error 1004 - PasteSpecial Method of Worksheet class failed'

I think its got something to do with the clipboard and I have searched all over the web to try and find a solution but nothing works. I am not much good with VBA and would love a simple solution such as an IF THEN function in my VBA script or something else that allows me to copy within Excel as well.

Thank you so much for your time,
 
Jason,

Thanks for the heads up about cross-posting and even more thanks for the VBA code.

Works perfectly and you my friend, are a genius!

Really appreciate your help and support.

Have yourself a fantastic week.

Thanks a million
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,215,664
Messages
6,126,101
Members
449,292
Latest member
Mario BR

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top