Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-28-2023, 12:16 AM
kiranappikatla kiranappikatla is offline VBA Copy Paste Issue Windows 8 VBA Copy Paste Issue Office 2019
Novice
VBA Copy Paste Issue
 
Join Date: Feb 2023
Posts: 2
kiranappikatla is on a distinguished road
Default VBA Copy Paste Issue

Hi Team,



We are getting error in word macro, while trying to copy and paste the table content from one word document to another word document.
But this is not happening all the time only few times we are getting this error.

Thanks,
Kiran A
Attached Images
File Type: png Layout Macro issue.PNG (20.6 KB, 23 views)
Attached Files
File Type: docm MPP_Transformation_Phase.docm (86.2 KB, 6 views)
Reply With Quote
  #2  
Old 02-28-2023, 04:31 PM
Guessed's Avatar
Guessed Guessed is offline VBA Copy Paste Issue Windows 10 VBA Copy Paste Issue Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Your template has a lot of code in it. Which macro and which line is the error occurring on?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 02-28-2023, 09:27 PM
gmayor's Avatar
gmayor gmayor is offline VBA Copy Paste Issue Windows 10 VBA Copy Paste Issue Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,101
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 of
Default

Frankly it would make more sense to create the template with the table elements already located and formatted rather than trying to format the document using lots of macro code. I would also recommend the use of ranges to locate the data rather than the selection object which can be a bit hit and miss, leading to the types of error you are encountering when the selection is not where they macro requires it to be.
I suggest that you declare all the variables you use rather than just some of them. It makes the code much easier to follow.
__________________
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
  #4  
Old 03-01-2023, 03:48 AM
kiranappikatla kiranappikatla is offline VBA Copy Paste Issue Windows 8 VBA Copy Paste Issue Office 2019
Novice
VBA Copy Paste Issue
 
Join Date: Feb 2023
Posts: 2
kiranappikatla is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Your template has a lot of code in it. Which macro and which line is the error occurring on?
Hi

Attached screenshot of my macro code. I'm getting at error where i kept breakpoint.
Attached Images
File Type: png Macro_code.PNG (19.4 KB, 17 views)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Copy Paste Issue Odd copy/paste issue - ad5624 Word 3 04-08-2021 08:11 PM
VBA Copy Paste Issue Printer issue (and copy/paste): some pictures/text are not printed/showed Jazz43 Drawing and Graphics 15 08-29-2016 04:17 AM
VBA Copy Paste Issue Copy paste issue for database klpw Excel Programming 1 01-28-2016 01:30 AM
VBA Copy Paste Issue Copy & Paste Issue anickles Excel 1 02-11-2015 11:32 AM
VBA Copy Paste Issue Word 2007 Copy/Paste Excel issue raven26c Word 1 11-18-2011 02:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:30 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