title: Randomize a list in Microsoft Word
body: <p>I am a teacher and I have been making a number of multiple choice tests for students using Microsoft Word. Is there a way for me to automatically shuffle the questions so that I can have multiple versions of the test without needing to copy and paste the questions around my test?
  Looking online I found a one solution posted by Steve Yandl in which he used macro after putting each question on a separate row in a table. I am trying to get his macro to work but it has and error. I know next to nothing about coding, so I am stuck. Here is his code: </p>
  
  <pre><code>Sub ShuffleQuestions()
  
  Dim Tmax As Integer
  Dim strCell As String
  Dim strQ As Variant
  Dim strText As String
  Dim I As Integer
  Dim Z As Integer
  Dim intQsLeft As Integer
  Dim rndQ As Integer
  Dim Q As Integer
  Dim vArray As Variant
  Dim strNew As String
  
  Set objDict = CreateObject("Scripting.Dictionary")
  
  Tmax = ThisDocument.Tables(1).Rows.Count
  
  For I = 1 To Tmax
  strCell = ThisDocument.Tables(1).Cell(I, 1).Range.Text
  strQ = Left(strCell, Len(strCell) - 1)
  objDict.Add strQ, strQ
  Next I
  
  ReDim arrQs(I - 1)
  
  intQsLeft = I - 2
  Z = 0
  
  
  Do While intQsLeft = 0
  Randomize
  rndQ = Int((intQsLeft + 1) * Rnd)
  intQsLeft = intQsLeft - 1
  vArray = objDict.Items
  strText = vArray(rndQ)
  arrQs(Z) = strText
  Z = Z + 1
  objDict.Remove strText
  Loop
  
  For Q = 1 To Tmax
  strNew = arrQs(Q - 1)
  strNew = Left(strNew, Len(strNew) - 1)
  ThisDocument.Tables(1).Cell(Q, 1).Range.Text = strNew
  Next Q
  
  
  End Sub
  </code></pre>
  
  <p>The error message I get says "run time error 5941 the requested member of the collection does not exist"
  When I choose the 'Debug' button it brings me to the line of code in the macro that says "Tmax = ThisDocument.Tables(1).Rows.Count"</p>
  
  <p>Ultimately I just want to reorder the questions, but I would be delighted if there was also a way to reorder my multiple choice options for each question.</p>