Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

copy select rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CShow - 20 Aug 2006 00:45 GMT
Hi

I would like to have a macro to find a particular style(A) and copy that
row. Once it finds all the "A" styles, it should copy all the rows to the
clipboard and open a new document and paste the clipboard contents.  Here is
part of the pseudocode:

      Jim
     History
    Fall
    A

      Great student

      Alice
     Art
     Spring
    B
    Loves to learn

     Allen  Science
    Fall
    A

      Zestful Student

      Steve
     Art
     Spring
    C
    Needs more work

Sub stylereport()

Dim oPara As Paragraph
For Each oPara In ActiveDocument.Range.Paragraphs
 Select Case oPara.Style
    Case Is = "A"
    SELECT ROWS WITH STYLE "A"
    Case Else
     'Do nothing
 End Select
Next oPara
OPEN NEW DOCUMENT
COPY ROWS OF STYLE "A"
End Sub

New document should have the following results:
        Jim
     History
    Fall
    A

      Great student

     Allen  Science
    Fall
    A

      Zestful Student

Thanks
Doug Robbins - Word MVP - 20 Aug 2006 05:38 GMT
Are the A's and the B's actually Styles as the term is defined in Word?

What separates each line of the information for each student?  Also, what
separates the information for one student from that of the next?

Need answers to these questions to provide appropriate advice.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi
>
[quoted text clipped - 59 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.