Results 1 to 6 of 6
  1. #1
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post
    Hello Loungers

    Its been a while and I see things have changed a bit. I hope the regular contributors are still here.

    I have a 223 page Word document that has test questions and their multiple choice answers. Each question starts
    with a number then a dot and then two spaces and then comes the question text. After the question text I have an
    empty line and then I have an upper case A with 2 spaces and then the text of the choice A answer, then comes
    an upper case B with two spaces and then the text of the choice B answer, and then an upper case C also with 2
    spaces and then the text of the choice C answer, and last an upper case D and two spaces and the text of the
    choice D answer. Two empty lines follow, and then comes the next question.

    This is the major setting of the document and what I am hoping for is to write a macro that would make all the
    questions bold and indent all the answers to about 0.5 on the horizontal ruler. One thing I have had trouble with is
    that some questions are 3 or 4 lines long, so I need to detect the question from the number with the dot and two
    spaces all the way until the empty line between the question and the answers. I have no idea what search form do
    I place in the Find What to find the questions.

    The 2nd task is that I would need to number these questions sequentially, right now they are in sections, 1 to 29,
    and then a section from 1 to 35 and then comes a section from 1 to 54, so after all that cleaning, I need to be
    able to have all these questions numbered from 1 to 118. I though of making a table but got lost in how to keep
    the questions and the answers together?

    Any help would be greatly appreciated.

    Thanks

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    Hello,

    Can you attach a (greatly shortened) version of the document you're currently working with? - that would help us get a better idea as to the best way to approach this. If there's any sensitive or copyrighted material in the questions themselves, just substitute dummy text.

    Gary

  3. #3
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post
    Thanks Gary

    For your fast suggestion. I was actually thinking of doing this, but then again I did not want you burden the Lounge with 223 pages.

    I have copied the first 5 pages so you can get a sample of these pages and I picked and pasted some of the problem areas I had problems with. The only thing is that the first couple of questions are already in order, but the full document is not.

    Thanks again

    Wassim
    Attached Files Attached Files
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts
    There is a lot of work to do this document formatting but it can be very quick if you know what you are doing.
    Step 1. Remove all empty paragraphs (Search for ^p^p and replace with ^p a couple of times)
    Step 2. Define a new MultiLevel List which put level 1 with an arabic numeral and level 2 with uppercase letters and resets on a higher level. Link level 1 with a style called Question. Link level 2 with a style called Answer. Note that these styles will be created in this step if they don't already exist
    Step 3. Run this macro
    Code:
    Sub Cleanup()
      Dim aPara As Paragraph
      For Each aPara In ActiveDocument.Paragraphs
        Select Case aPara.Range.Characters(1)
          Case 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
            aPara.Style = "Question"
          Case Else
            aPara.Style = "Answer"
         End Select
      Next aPara
      ActiveDocument.Content.Select
      WordBasic.ToolsBulletsNumbers Replace:=0, Type:=1, Remove:=1
    End Sub
    Step 4. Select All, align center, align left (this strips the leading space from each paragraph). Do this by the keyboard commands Ctrl-A, Ctrl-E, Ctrl-L
    Step 5. Modify the Question and Answer styles so they look the way you want them to.
    Attached Files Attached Files
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post
    Thank You Andrew

    I had a feeling styles will be involved, and I should admit that this is one area I need to study up on.

    The code did a great work, and the document is pretty much the way I want it, it only took 3 seconds wow!!!

    But if you would please take a moment of your time and expain to me how do create a style, this way I can modify
    these ones and make more to make this document the way I really would like to submit it.

    Thanks again.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts
    There are plenty of resources on the interweb for learning about styles. Try these ones for starters.
    Word 2007 specific
    http://www.desitwist.com/tutorials-c...les-25595.html
    Earlier versions and more general
    Word MVPS Create a Template Part II
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •