Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2016, 05:46 PM
Chayes Chayes is offline Pasting as unformatted text VBA Windows XP Pasting as unformatted text VBA Office 2003
Advanced Beginner
Pasting as unformatted text VBA
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default Pasting as unformatted text VBA

Hi All

I have several macros in my Word 2003 installation. I have been using them with no hitch on XP for years. Now I've transferred to a Win 7 Pro machine , I'm getting errors from my code and the macros are failing.

This VBA , which I use to paste the content of the clipboard as unformatted text :

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

now gives errors.

I've tried various things to try to get this to work , with no success. It either gives an error , or if it does paste , it pastes the clipboard content in its formatted form , which is not what I need.

Can sometime help with some code to paste the content of the clipboard as unformatted text?

Grateful for any help.
Reply With Quote
  #2  
Old 02-18-2016, 06:28 PM
macropod's Avatar
macropod macropod is offline Pasting as unformatted text VBA Windows 7 64bit Pasting as unformatted text VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,369
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Do you have FireFox installed?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-18-2016, 06:45 PM
Chayes Chayes is offline Pasting as unformatted text VBA Windows XP Pasting as unformatted text VBA Office 2003
Advanced Beginner
Pasting as unformatted text VBA
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default

Yes , I have Firefox installed. In fact I'm copying my text from there to paste into Word. Is that causing the issue , do you think?

Thanks for your help.
Reply With Quote
  #4  
Old 02-18-2016, 06:52 PM
macropod's Avatar
macropod macropod is offline Pasting as unformatted text VBA Windows 7 64bit Pasting as unformatted text VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,369
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

A recent FireFox update has apparently broken some aspect of the Windows clipboard. You could use a different browser, undo the most recent FireFox update or wait till the next one comes out.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-18-2016, 07:08 PM
Chayes Chayes is offline Pasting as unformatted text VBA Windows XP Pasting as unformatted text VBA Office 2003
Advanced Beginner
Pasting as unformatted text VBA
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default

Hi

OK thanks for getting back. I would never have thought of that!

I just opened the page I'm copying from in IE , and my Word macro ran perfectly! Copy from the same page in Firefox , and the macro gives errors.

I've got the latest Firefox , so I guess I'll have to wait until they fix it in some new update. I'm sure they must be aware of it.

Thanks again. At least I know that I don't need to re-write my macros.

Best Wishes ,
Reply With Quote
  #6  
Old 02-18-2016, 10:12 PM
gmayor's Avatar
gmayor gmayor is offline Pasting as unformatted text VBA Windows 10 Pasting as unformatted text VBA Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Quote:
Originally Posted by macropod View Post
A recent FireFox update has apparently broken some aspect of the Windows clipboard. You could use a different browser, undo the most recent FireFox update or wait till the next one comes out.
Interesting - and perhaps could explain the issue we have been discussing privately?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #7  
Old 02-18-2016, 10:20 PM
macropod's Avatar
macropod macropod is offline Pasting as unformatted text VBA Windows 7 64bit Pasting as unformatted text VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,369
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Might have some bearing, though I only found out about this yesterday and wouldn't have thought it likely to interfere with DataObjects & the PutInClipboard method. Still, worth exploring.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 02-28-2016, 03:37 PM
Chayes Chayes is offline Pasting as unformatted text VBA Windows XP Pasting as unformatted text VBA Office 2003
Advanced Beginner
Pasting as unformatted text VBA
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default

I found a solution to this issue.

Instead of pasting text using Ctrl-V, you simply use Ctrl-Shift-V to do so.

The difference between the options is that the latter pastes the text without formatting while the former retains it. You can also hold down Shift while using the mouse to paste contents in the browser as this works fine as well.
Reply With Quote
  #9  
Old 02-28-2016, 07:54 PM
macropod's Avatar
macropod macropod is offline Pasting as unformatted text VBA Windows 7 64bit Pasting as unformatted text VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,369
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That's fine, but it doesn't resolve the issue of pasting with VBA, which is what your first post was concerned with.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #10  
Old 02-29-2016, 07:07 AM
Chayes Chayes is offline Pasting as unformatted text VBA Windows XP Pasting as unformatted text VBA Office 2003
Advanced Beginner
Pasting as unformatted text VBA
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default

No , that's true. Pasting via VBA remains an issue.
Reply With Quote
  #11  
Old 02-29-2016, 06:17 PM
Chayes Chayes is offline Pasting as unformatted text VBA Windows XP Pasting as unformatted text VBA Office 2003
Advanced Beginner
Pasting as unformatted text VBA
 
Join Date: May 2012
Posts: 79
Chayes is on a distinguished road
Default

Ok I find this works :


Selection.PasteAndFormat (wdFormatPlainText)
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting as unformatted text VBA Unformatted text paste macro Ulodesk Outlook 1 07-03-2014 02:03 PM
need a shortcut for paste special link unformatted text noetic76 Word VBA 2 06-29-2014 06:40 PM
Pasting as unformatted text VBA Unformatted meeting request in Outlook 2010 dwolnik Outlook 5 07-14-2011 11:27 AM
Pasting as unformatted text VBA Paste Special Unformatted Text kenwpaul Office 2 02-25-2011 04:53 PM
Pasting as unformatted text VBA Macro to paste unformatted text Andacar Word 2 01-05-2011 09:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft