Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #37  
Old 07-14-2011, 07:27 AM
macropod's Avatar
macropod macropod is offline Copy/Paste/Delete Table & Section etc. Windows 7 64bit Copy/Paste/Delete Table & Section etc. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,523
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

Quote:
Originally Posted by flds View Post
You will notice in Post # 20 and 26 I said that the document may contain more the 1 section that contains 'Design Requirements'
And, when I sought clarification, in terms of Word Section breaks (which is what I've used for everything else):
Quote:
Regarding the 'Design Requirements' portion of the document, when I refer to 'Section' I mean a Word Section defined via Section breaks - Word has no such thing as sub-sections. So, does the 'Design Requirements' portion of the document consist of one Section?
you replied with:
Quote:
Yes, it consist of one section.
So, to get the code to work with multiple consecutive 'Design Requirement' Sections, change the line:
Code:
Dim DocApp As Document, DocRef As Document, oShp As Shape, iShp As InlineShape
to:
Code:
Dim DocApp As Document, DocRef As Document, oShp As Shape, iShp As InlineShape, SubSctn As Section
and, replace:
Code:
      If InStr(UCase(Sctn.Range.Sentences.First), "DESIGN REQUIREMENT") > 0 Then
        Set Rng = Sctn.Range
        'Cut the 'Design Requirement' Section from the
        'source document and paste it into a new references document
        Rng.Cut
with:
Code:
      If InStr(UCase(Sctn.Range.Sentences.First), "DESIGN REQUIREMENT") > 0 Then
        Set Rng = Sctn.Range
        Rng.End = .Range.End
        'Find the end of the last 'Design Requirements' Section
        For Each SubSctn In Rng.Sections
          If InStr(UCase(SubSctn.Range.Sentences.First), "DESIGN REQUIREMENT") = 0 Then
            Rng.End = SubSctn.Range.Start - 1
            Exit For
          End If
        Next
        'Cut the 'Design Requirement' Sections from the
        'source document and paste them into a a new design requirements document
        Rng.Cut
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy/Paste/Delete Table & Section etc. copy and paste not working Ellie Word 3 11-07-2013 02:23 PM
Can't copy paste irenasobolewska Office 2 10-26-2012 05:09 PM
Copy - Paste between 2 tables rod147 Excel 1 10-22-2009 08:21 PM
Copy & paste low resolution worriedme Drawing and Graphics 0 06-01-2009 03:05 AM
Copy/Paste/Delete Table & Section etc. Copy and paste special Dace Excel 2 02-16-2009 12:18 PM

Other Forums: Access Forums

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