Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2021, 08:22 AM
jeffreybrown jeffreybrown is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
Hide checkmark and the word following it
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default 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?
Attached Images
File Type: jpg Capture.JPG (31.0 KB, 26 views)
Reply With Quote
  #2  
Old 02-17-2021, 01:49 PM
Guessed's Avatar
Guessed Guessed is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #3  
Old 02-21-2021, 01:18 PM
jeffreybrown jeffreybrown is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
Hide checkmark and the word following it
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default 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.
Attached Files
File Type: docx Statistics Progress Check.docx (29.8 KB, 7 views)
Reply With Quote
  #4  
Old 02-21-2021, 03:09 PM
Guessed's Avatar
Guessed Guessed is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #5  
Old 02-21-2021, 04:16 PM
jeffreybrown jeffreybrown is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
Hide checkmark and the word following it
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

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.
Reply With Quote
  #6  
Old 02-21-2021, 09:06 PM
Guessed's Avatar
Guessed Guessed is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #7  
Old 02-21-2021, 10:08 PM
gmayor's Avatar
gmayor gmayor is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #8  
Old 02-23-2021, 11:32 AM
jeffreybrown jeffreybrown is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
Hide checkmark and the word following it
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

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.
Attached Files
File Type: docm Statistics Progress Check-1.docm (43.9 KB, 5 views)
Reply With Quote
  #9  
Old 02-23-2021, 04:25 PM
Guessed's Avatar
Guessed Guessed is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
The macros should NOT be available to the students. This is easily done by putting the macros in the Attached Template (on your machine) instead of in the document itself. Save the student docs as docx. Since you have the macros, you can run them and the students won't know the macros exist.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #10  
Old 02-23-2021, 05:14 PM
jeffreybrown jeffreybrown is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
Hide checkmark and the word following it
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

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.
Attached Files
File Type: docm Statistics Progress Check-1.docm (47.2 KB, 7 views)
Reply With Quote
  #11  
Old 02-23-2021, 05:55 PM
Guessed's Avatar
Guessed Guessed is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #12  
Old 02-23-2021, 06:39 PM
jeffreybrown jeffreybrown is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
Hide checkmark and the word following it
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Hi Andrew,

Okay thanks. I'll give this a try.
Reply With Quote
  #13  
Old 02-23-2021, 07:23 PM
jeffreybrown jeffreybrown is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
Hide checkmark and the word following it
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

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
Reply With Quote
  #14  
Old 02-23-2021, 07:46 PM
Guessed's Avatar
Guessed Guessed is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Quote:
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?
The green&bold is applied to the correct answers (as determined by the quiz creator). The red highlight is applied to any checkbox that is not answered correctly by the student. These format decisions are independent of each other.

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
Reply With Quote
  #15  
Old 02-23-2021, 08:19 PM
jeffreybrown jeffreybrown is offline Hide checkmark and the word following it Windows 10 Hide checkmark and the word following it Office 2016
Expert
Hide checkmark and the word following it
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Okay, got it. Thanks for all your help.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide checkmark and the word following it 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

Other Forums: Access Forums

All times are GMT -7. The time now is 01:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft