![]() |
#1
|
|||
|
|||
![]() 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? |
#2
|
||||
|
||||
![]()
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
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
||||
|
||||
![]()
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 |
![]() |
Tags |
copy, find, paste |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |
![]() |
konopca | Word VBA | 5 | 02-20-2014 02:34 PM |
![]() |
tinfanide | Word | 6 | 03-06-2013 12:21 AM |
![]() |
jperez84 | Word VBA | 24 | 09-20-2012 11:34 AM |