#1
|
|||
|
|||
Hide checkmark and the word following it
I have a quiz which I need to mark the correct answer. I could easily mark the text with Ctrl + H and simply hide it, but as soon as they turn on the paragraph marks they would see it. Any suggestions?
|
#2
|
||||
|
||||
You could use a different style for the answer and just change it's attributes to highlight it.
Or you could put the answers into a content control so that each one is defined and then you could use a macro to highlight the content controls or add the checkmark. These methods are both putting clues in the Word document that smart students could work out but if the test goes out as a PDF or as a printed sheet then they would be fine.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Mark answers in quiz
Hi Andrew and sorry for the delay. Had a few things going on so just got back to this. In the document I've attached, it's just a cut down version, but representative of the larger document.
I used the three style approach, as offered by Charles, but only from the Question, Answer, Last Answer aspect. I would be interested to see the content control approach you were speaking of with the macro to highlight the answers. I know how to use the CC's, but not so up on the Word macro part. |
#4
|
||||
|
||||
Select each line that is correct and insert a Plain Text Content Control around it. You don't want the "- correct" text in your example.
Then run this macro. I've set it up to toggle so running it alternates showing or hiding the correct answers. Code:
Sub ToggleAnswers() Dim aCC As ContentControl, iColor As Long, iShowCC As Integer If ActiveDocument.ContentControls(1).Range.Font.ColorIndex = wdBlack Then iColor = wdGreen iShowCC = wdContentControlBoundingBox Else iColor = wdBlack iShowCC = wdContentControlHidden End If For Each aCC In ActiveDocument.ContentControls With aCC.Range.Paragraphs(1).Range.Font .ColorIndex = iColor .Bold = .ColorIndex = wdGreen aCC.Appearance = iShowCC End With Next aCC End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
|||
|
|||
That is a great alternative Andrew. Thank you. This is much more preferably than the hidden text. I guess if they are sly enough to turn on the Design mode, then they deserve the answers.
|
#6
|
||||
|
||||
In principle, yes they could turn on Design Mode or run a macro to reveal what is in a Content Control but...
The example document you loaded actually doesn't lend itself to a person doing the test in Word - put yourself in their position and work out how you would indicate the right answer. It looks like it needs to be printed out and the student uses a pen to circle or tick their answers. If you wanted them to be using an electronic version in Word you should be putting checkboxes next to every possible answer to make it possible for them to answer the questions quickly. If you did that, the code would likely need to be modified to not touch the checkboxes (which are also CCs). It would actually be conceivably possible to create a macro to automatically score a test if that was done.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#7
|
||||
|
||||
I have an add-in available on my web site that produces such question forms, but while it could be used in a classroom environment where there is supervision, you could not simply e-mail it, because it suffers from the same problem endemic to all macro solutions, in that you cannot force the user to run the macros, without which it won't work.
It does not include the answers, only the ability to make choices. The results can be processed when the questionnaire is returned.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#8
|
|||
|
|||
Thanks Andrew and Graham. I have modified the document adding the checkboxes and tried to update the code to only highlight the Plain Text Content Controls. I used tags, but not sure this would be the proper way. It seems to work okay.
Also, since we are working in a virtual environment, the students will download the quiz, and as you point out Graham, we can't ensure the macros will be enabled. So, taking that next step, how can the result be processed once returned. In the case, I only have the two questions, but it represents the test in the sense, some questions will only have one answer, while some could have multiple (like Q#1). Finally, maybe the tricky part for processing the results. If the Q & A is a single answer, it's worth 7 points. If the Q & A is a multiple answer, then those should be divided by the number of answers. So, for Q#1, 3 answers divided by 7. |
#9
|
||||
|
||||
I've had a play with this and think there are multiple ways to score a sheet. I'm going to ignore your /7 suggestion as I can't appreciate your logic for that number. Instead, I'll provide two possible methods of scoring. Method 1 is simplistic as it treats EVERY checkbox as an independent question and so a completely blank sheet will likely return a score well over 50%.
Method 2 requires you to add Rich Text CCs around each question/answer set so there is a scope for the macro to determine where a question starts and finishes. It then applies a hard binary score for that question - you have to have each checkbox correct to get 1 otherwise you get zero. I like this method 2 macro because it highlights exactly where the student made mistakes and what they 'should' have chosen. Code:
Sub ScoreQuiz1() Dim aCC As ContentControl, iColor As Long, iShowCC As Integer Dim iChecks As Integer, iRight As Integer, bRight As Boolean funShow True For Each aCC In ActiveDocument.ContentControls If aCC.Type = wdContentControlCheckBox Then iChecks = iChecks + 1 bRight = aCC.Range.Paragraphs(1).Range.Font.ColorIndex = wdGreen If aCC.Checked = bRight Then iRight = iRight + 1 End If Next aCC MsgBox "Correct answers: " & iRight & vbCr & "Out of: " & iChecks, vbInformation + vbOKOnly, "Paper Score Method 1" End Sub Sub ScoreQuiz2() Dim aCC As ContentControl, aCCcb As ContentControl, aRng As Range Dim iQuestions As Integer, iQ As Integer, iRight As Integer, bRight As Boolean funShow True For Each aCC In ActiveDocument.ContentControls If aCC.Type = wdContentControlRichText Then aCC.Tag = "Question" Next aCC iQuestions = ActiveDocument.SelectContentControlsByTag("Question").Count For Each aCC In ActiveDocument.SelectContentControlsByTag("Question") Set aRng = aCC.Range iQ = 1 For Each aCCcb In aRng.ContentControls If aCCcb.Type = wdContentControlCheckBox Then bRight = aCCcb.Range.Font.ColorIndex = wdGreen If Not aCCcb.Checked = bRight Then aCCcb.Range.Paragraphs(1).Range.ParagraphFormat.Shading.BackgroundPatternColorIndex = wdRed iQ = 0 End If End If Next aCCcb iRight = iRight + iQ Next aCC MsgBox "Correct answers: " & iRight & vbCr & "Out of: " & iQuestions, vbInformation + vbOKOnly, "Paper Score Method 2" End Sub Sub HideAnswers() funShow False End Sub Sub ShowAnswers() funShow True End Sub Sub funShow(bSet As Boolean) Dim aCC As ContentControl, iColor As Long, iShowCC As Integer If bSet Then iColor = wdGreen iShowCC = wdContentControlBoundingBox Else iColor = wdBlack iShowCC = wdContentControlHidden End If ActiveDocument.Range.ParagraphFormat.Shading.BackgroundPatternColorIndex = wdWhite For Each aCC In ActiveDocument.ContentControls If aCC.Type = wdContentControlText Then With aCC.Range.Paragraphs(1).Range.Font .ColorIndex = iColor .Bold = .ColorIndex = wdGreen aCC.Appearance = iShowCC End With End If Next aCC End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#10
|
|||
|
|||
Hi Andrew and thank you for this addition. I also like method #2 and have implemented it the best I understand. So basically, create the entire question/answers as a Rich Text CCs and then the answers as a Plain Text Content Control. I've done this, but based on this attached sample, I would expect the answer to be, 1 out of 3 correct. Maybe I still don't understand.
|
#11
|
||||
|
||||
Jeffrey
In that version, you have somehow put the first checkbox inside a Rich Text CC so the total count of Rich Text CCs in this example is 6. Try deleting the checkbox for each of the A's and recreate as JUST a CheckBox CC. Then try the macro again. Note that my code automates tagging all the Rich Text CCs and so it also picked up those renegade Rich Text CCs. You could remove that line if you wanted to manually tag the 'question CCs'.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#12
|
|||
|
|||
Hi Andrew,
Okay thanks. I'll give this a try. |
#13
|
|||
|
|||
Hi Andrew,
So, fixed the Checkbox CC's and it's working great now. Instead of the message box, I added a table to store the score. Not sure how I want to process the score right now so I just did a simple divide right to wrong. One more question if I could. The correct answer gets the green font, but it also gets the highlight. Can I apply the green font and a different highlight to the correct question? Code:
' MsgBox "Correct answers: " & iRight & vbCr & "Out of: " & iQuestions, vbInformation + vbOKOnly, "Paper Score Method 2" With ActiveDocument.Tables(1) .Cell(2, 1).Range.Text = iRight .Cell(2, 2).Range.Text = iQuestions .Cell(2, 3).Range.Text = Format(iRight / iQuestions, "0.00%") .Cell(2, 3).Range.Font.TextColor = wdColorRed .Cell(2, 3).Range.Font.Bold = True End With |
#14
|
||||
|
||||
Quote:
Your macro sample can apply formatting to the table contents but that is overkill if it isn't being changed. You can apply desired formatting to the table using the GUI before the code runs to populate the table.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#15
|
|||
|
|||
Okay, got it. Thanks for all your help.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can you hide a comment in word using vba? | mrlemmer11 | Word VBA | 1 | 07-05-2015 03:23 PM |
How to Hide/Un-hide a worksheet based on cell on another sheet. | easton11 | Excel Programming | 1 | 06-02-2015 12:07 PM |
Inserts a checkmark when click on a cell | imfloyd | Excel | 3 | 01-17-2015 04:52 AM |
Hide cursor in Word file | Cosmo | Word | 1 | 10-26-2012 02:46 PM |
Checkmark function problem | todddesignr | PowerPoint | 0 | 07-29-2011 07:40 AM |