Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-28-2015, 09:07 AM
Hdata Hdata is offline Using Paste in my VBA code Windows 7 32bit Using Paste in my VBA code Office 2010 32bit
Novice
Using Paste in my VBA code
 
Join Date: Jan 2014
Posts: 26
Hdata is on a distinguished road
Default Using Paste in my VBA code


Thanks in advance,

I use the copy and paste keywords in VBA code, and at times I get a message "Recording clipboard style sheet will require copying many styles. Do you want to use normal styles instead?" This message box stops my code asking me to choose yes or no. Well, I want to keep the styles being pasted and I wish this message would not interrupt my code.

Any way to avoid this message?
Reply With Quote
  #2  
Old 06-28-2015, 03:49 PM
gmaxey gmaxey is offline Using Paste in my VBA code Windows 7 32bit Using Paste in my VBA code Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

I can't produce that (I must not be trying to copy enough styles). Have you tried:

Application.DisplayAlerts=wdAlertsNone
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 06-29-2015, 09:46 AM
Hdata Hdata is offline Using Paste in my VBA code Windows 7 32bit Using Paste in my VBA code Office 2010 32bit
Novice
Using Paste in my VBA code
 
Join Date: Jan 2014
Posts: 26
Hdata is on a distinguished road
Default

Thank you so much, Application.DisplayAlerts=wdAlertsNone works great.
Reply With Quote
  #4  
Old 06-29-2015, 02:22 PM
gmaxey gmaxey is offline Using Paste in my VBA code Windows 7 32bit Using Paste in my VBA code Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

In practice you might want to:

Dim lngOpt as Long
lngOpt = Appilcation.DisplayAlerts
Application.DisplayAlerts = wdAlertsNone
'Do the deed
Application.DisplayAlerts = lngOpt
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #5  
Old 11-09-2015, 03:21 PM
foverman foverman is offline Using Paste in my VBA code Windows 7 64bit Using Paste in my VBA code Office 2013
Novice
 
Join Date: Nov 2015
Posts: 2
foverman is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
...
Application.DisplayAlerts = wdAlertsNone
...
I love your approach and really thought that it would solve my problem.
I have a feeling I'm not going to like the answer, but I'm going to ask the question anyway, just in case.

When I paste, I answer No - I don't want to use Normal.
Turning off DisplayAlerts gets rid of the annoying prompt, but seems to answer with the default Yes - I do want to use Normal

So the question is, is there any way to modify this so that it doesn't use normal? I'm guessing any answer would have to involve SendKeys or something.

Thanks!
Reply With Quote
  #6  
Old 11-09-2015, 06:39 PM
Hdata Hdata is offline Using Paste in my VBA code Windows 7 32bit Using Paste in my VBA code Office 2010 32bit
Novice
Using Paste in my VBA code
 
Join Date: Jan 2014
Posts: 26
Hdata is on a distinguished road
Default

Using paste in my VBA code depends on how much I am pasting. If the amount of text you are pasting is relatively small, this approach works well and does not apply the normal formatting. However, when I paste a large amount of text, the answer seems to be yes. Seems this approach works to protect against crashing the system with too much formatting.

Best always
Reply With Quote
  #7  
Old 11-09-2015, 07:53 PM
foverman foverman is offline Using Paste in my VBA code Windows 7 64bit Using Paste in my VBA code Office 2013
Novice
 
Join Date: Nov 2015
Posts: 2
foverman is on a distinguished road
Default

Quote:
Originally Posted by Hdata View Post
Using paste in my VBA code depends on how much I am pasting. If the amount of text you are pasting is relatively small, this approach works well and does not apply the normal formatting. However, when I paste a large amount of text, the answer seems to be yes. Seems this approach works to protect against crashing the system with too much formatting.

Best always

I'm copying from the web page output of a system that's being developed for my company. The amount of text can vary. Worst case, so far, is copying ~1600 lines of data from three web pages of output - total about 5,000 lines. That's worst case. Most are only a few hundred lines. And I need the formatting to evaluate the output.

They've just upgraded idea to Office 2013. Pasting directly into Excel has become so painfully slow, but I discovered that pasting into Word, cutting, then pasting into Excel is rather quick. And there are these annoying notifications.

I've not had any problem with system crashes while doing this. And this is a stop-gap measure during the evaluation. Eventually it will email us reports, but until this is enabled, I'm doing the copy / paste bit.

So, if there's any way to automate pasting in Word with formatting, that would be great.

Thanks,
Frank
Reply With Quote
  #8  
Old 11-09-2015, 07:56 PM
macropod's Avatar
macropod macropod is offline Using Paste in my VBA code Windows 7 64bit Using Paste in my VBA code Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

If you're trying to replicate content, including formatting, you should consider using the .FormattedText method (I've made posts here using it) instead of Copy/Paste. Conversely, if you're trying to replicate text without formatting, you can use the .Text, .InsertAfter or .InsertBefore methods instead of Copy/Paste.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 03-21-2019, 03:20 AM
EmanueleLotti3 EmanueleLotti3 is offline Using Paste in my VBA code Windows 10 Using Paste in my VBA code Office 2016
Novice
 
Join Date: Mar 2019
Posts: 2
EmanueleLotti3 is on a distinguished road
Default

Hi, same problem here.

I'd like to use FormattedText but I need to paste text and tables from multiple sources, not just a single file, to one document. Is there a way to do so?

Thanks in advance.
Reply With Quote
  #10  
Old 03-21-2019, 09:52 PM
macropod's Avatar
macropod macropod is offline Using Paste in my VBA code Windows 7 64bit Using Paste in my VBA code Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

See: https://www.msofficeforums.com/word-...documents.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 03-25-2019, 07:57 AM
EmanueleLotti3 EmanueleLotti3 is offline Using Paste in my VBA code Windows 10 Using Paste in my VBA code Office 2016
Novice
 
Join Date: Mar 2019
Posts: 2
EmanueleLotti3 is on a distinguished road
Default

Thanks a lot!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Paste in my VBA code QR-code qrcode Word 3 05-26-2015 06:38 AM
Using Paste in my VBA code Need Help with Below Code rsrasc Word VBA 6 04-01-2014 03:42 PM
Paste to a series of boxes with one paste? BudVitoff Misc 0 11-27-2013 02:51 PM
Using Paste in my VBA code Paste Special: Copy and Paste Formatting Only? tinfanide Word 6 03-06-2013 12:21 AM
Using Paste in my VBA code "Paste cells" in paste menu averagejoe Word 2 03-13-2012 05:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:23 AM.


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