![]() |
|
#1
|
|||
|
|||
![]()
Hi,
It's my first post! ![]() I need your help please in formatting Multiple Choice Questions. I want to keep the question and its choices to be together in same page. Did some google search, tried keep lines together and keep with next; but they didn't work for me. [may be because it considers each choice (level 2) as new paragraph] ![]() |
#2
|
|||
|
|||
![]()
Set up your numbering following the instructions here:
How to create numbered headings or outline numbering in Ribbon Versions of Word by Shauna Kelly Use three styles for this. Use both keep with next and keep lines together, selectively. 1. Question - use both for this style. Level 1 style a. - d. - use both - those are the level 2 numbering style e. - use keep lines together but not keep with next. This is a separate style (Level 2a) based on the level 2 style without keep with next. Modify your styles so that level 1 and 2 styles are both followed by level 2 style. You may want a keyboard shortcut for the level 2a style. Follow the level 2a style with the level 1 style. The level 2a style is for the last answer in the list. |
#3
|
|||
|
|||
![]()
Got the idea, but! how can I implement this. I have +10,000 questions
![]() Anyway to keep last choice to be of level2a style? doing it manually is really pain |
#4
|
||||
|
||||
![]()
Perhaps the simplest way to implement this is to apply the 'keep with next' attribute to Styles used for both the questions and their answers, but to have a paragraph in a different Style that doesn't have the 'keep with next' attribute between the last answer and the next question. I wouldn't ordinarily recommend having empty paragraphs but, in this case, it seems the simplest route to an effective solution that's easy to maintain.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]() Quote:
|
#6
|
||||
|
||||
![]()
You could, for example, use Find/Replace to insert an empty paragraph before every question. So, if your questions use the Heading 1 Style, simply do a Find/Replace for that with:
Find Style = Heading 1 Replace = ^p^& It's a bit trickier to do the rest manually from there for +10,000 questions, but the following macro should take care of the lot: Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range If .Characters.Last.Previous <> vbCr Then .InsertAfter vbCr With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "" .Replacement.Text = "^p^&" .Format = True .Style = wdStyleHeading1 .Forward = True .MatchWildcards = False .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With If .Characters.First = vbCr Then .Characters.First.Delete With .Find .ClearFormatting .Replacement.ClearFormatting .Format = False .Text = "[^13]{2,}" .Replacement.Text = "" .MatchWildcards = True .Wrap = wdFindStop .Execute End With Do While .Find.Found .Paragraphs.Last.Range.Style = wdStyleNormal .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
![]()
Wonderful!! Thanks a lot... I did the Find/Replace and the result is:
![]() and the micro did the rest! I have some curiosity.. can you please explain briefly what does this micro do? Is it possible to do what you have done without micro? that will be interesting if yes ![]() ![]() ![]() |
#8
|
||||
|
||||
![]() Quote:
The macro starts off by inserting an empty paragraph at the end of the document if there isn't already one there. It then does the Find/Replace I described. That produces a pair of consecutive paragraph breaks before any Heading 1 - the last also being in the Heading1 Style (from your description, the preceding one will typically be in the Heading 2 Style). This is followed by another more complicated Find/Replace - which wouldn't be easy to do manually - in which the last in any series of consecutive paragraph breaks is given the 'Normal' Style (which ordinarily won't have the 'keep with next' attribute). That allows your document to create its own page break between questions where a question and all its answer choices won't fit on the same page. Finally, the macro deletes the first character in the document if that character is a paragraph break - something that could be cause by the initial Find/Replace if the document starts with a question.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
I’ve no background on vba at all. But I would love to know how to do the above vba code with find/replace. I faced this similar problem a lot ! Would highly appreciate it
|
#10
|
||||
|
||||
![]() Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
![]() Quote:
|
#12
|
|||
|
|||
![]()
Take a look, again, at my original post, which tells you how to do this, without macros.
No empty paragraph is needed or desirable. Generally speaking, empty paragraphs are a bad thing. 2.2 Why you should press Enter only once to end a paragraph Instead, you can use larger spacing-after paragraph formatting as part of the style for that last answer. See the macro-free document "Question Styles" on my downloads page. |
#13
|
|||
|
|||
![]() Quote:
1- how can I make last choice to have the 'third style', going through +10,000 questions? 2- how to deal the numbering; not all questions have [A-E] choices; so 'third style' should continue numbering from previous choices. how?! Thanks ![]() |
#14
|
|||
|
|||
![]() Quote:
Quote:
QuestionStylesDownload[1].gif Last edited by Charles Kenyon; 03-25-2018 at 07:00 AM. |
#15
|
|||
|
|||
![]() Quote:
2] tested it but didn't work for me: ![]() EDIT: and it didn't change last choice to its style automatically; I had to do it manually |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trying to add space between lines of bulleted text and a new header but both lines are moving??? | Martin_d35 | Word | 2 | 02-10-2017 07:13 AM |
![]() |
dlapham9 | Word | 1 | 10-26-2016 07:23 PM |
Deleting grid lines but keeping the axis lines | CoffeeNut | Excel | 0 | 04-01-2013 01:50 PM |
![]() |
gfswolf | Word | 6 | 01-02-2012 02:33 PM |
![]() |
Welshie82 | Mail Merge | 2 | 11-14-2011 01:41 AM |