Word for constructing tests

G

Guest

Does anyone know of an easy way to (once multiple-choice
questions for a test have been typed into Word) scramble
the question order and /or scramble the option order?
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

The following macro will ask you how many students and for how many
questions you want to do this for and will then create that number of
scrambled documents. (Have fun unscrambling them to mark them)

Dim i As Integer, j As Integer, k As Integer, Source As Document, Target As
Document, students As Long, Questions as long
Dim Message, Title, question As Range
Message = "Enter number of students" ' Set prompt.
Title = "Randomizer" ' Set title.
' Display message, title
students = InputBox(Message, Title)
Message = "Enter number of questions to be scrambled" ' Set prompt.
Title = "Randomizer" ' Set title.
' Display message, title
Questions = InputBox(Message, Title)

For k = 1 To students
Set Source = Documents.Open("E:\Worddocs\source1.doc")
Set Target = Documents.Add
For i = Questions To 0 Step -1
j = Int((i * Rnd) + 1)
Set question = Source.Paragraphs(j).Range
Target.Range.InsertAfter question
question.Delete
Next i
' Print and Close Document with random list of questions
Target.PrintOut
' Target.SaveAs ("E:\worddocs\student" & k & ".doc")
Target.Close SaveChanges:=wdDoNotSaveChanges
Source.Close SaveChanges:=wdDoNotSaveChanges
Next k

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top