Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-09-2024, 11:44 PM
JohnHare JohnHare is offline Find, Copy and Paste Windows 11 Find, Copy and Paste Office 2021
Novice
Find, Copy and Paste
 
Join Date: Jul 2024
Posts: 1
JohnHare is on a distinguished road
Default Find, Copy and Paste


Hi, I am new in this forum, have just very limited skills on VBA yet and hope to get some help for a script.
I have a word document with 250 pages. On each page is a headline and a table. On some pages there are notes after the table which I need to copy to a new document together with the headline. If there are no notes I dont want to copy it.
Are there any ideas how to do that?
Reply With Quote
  #2  
Old 07-10-2024, 08:12 AM
gmayor's Avatar
gmayor gmayor is offline Find, Copy and Paste Windows 10 Find, Copy and Paste Office 2019
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

You would need to provide more information in order to work out how to do this..
There are no 'pages' in a Word document, so you would need to explain what constitutes a 'page'. e.g. is there a manual page break, or a section break of just text flow?
How and where is the headline placed so that it may be identified as such?
How are the notes formatted?
Would you want all the headlines and the associated notes without the tables in a single document or one document for each headline?
If it is just a matter of losing the tables, then create a new document using your document as a template and then loop through the document and delete all the tables.
e.g.
Code:
Dim i As Long
For i = ActiveDocument.Tables.Count To 1 Step -1
    ActiveDocument.Tables(i).Delete
Next
If not, can you provide a couple of consecutive pages so we may see how the document is formatted?
__________________
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
  #3  
Old 07-10-2024, 03:42 PM
Guessed's Avatar
Guessed Guessed is offline Find, Copy and Paste Windows 10 Find, Copy and Paste Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
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

There are multiple ways you could approach this problem and the best solution would heavily depend on how you define 'notes' and 'headline'. If you are consistently using styles then it could be coded relatively easily.

I would probably do this as a multi-step process.
1. Remove all tables using Graham's suggestion
2. Remove all empty paragraphs (if there are any)
3. Step through each 'headline' and delete it if it is followed by another 'headline'
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Tags
copy, find, paste



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find, Copy and Paste When I copy&paste a second copy appears that can't be edited makeo22 Word 3 04-26-2017 07:09 PM
Trying to find a macro that will copy a cell and paste that value to a specific sheet bryans88 Excel Programming 1 12-23-2015 01:40 PM
Find, Copy and Paste Find specific rows then copy and paste to new doc konopca Word VBA 5 02-20-2014 02:34 PM
Find, Copy and Paste Paste Special: Copy and Paste Formatting Only? tinfanide Word 6 03-06-2013 12:21 AM
Find, Copy and Paste Find, copy and paste into a new page jperez84 Word VBA 24 09-20-2012 11:34 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:07 PM.


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