Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-02-2014, 02:39 AM
frustrated teacher frustrated teacher is offline Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Windows 7 64bit Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Office 2010 64bit
Novice
Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question
 
Join Date: May 2014
Posts: 12
frustrated teacher is on a distinguished road
Default Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question

Hello friends,



So, it's exam time and my small school has a limited number of scantron machines, few of which are broken.

It seems that I have to hand grade some tests in order to meet the deadline.

How would I go about creating a macro that will delete the unneeded answers to a multiple choice question?

The questions are in plain text, with "A", "B", "C", "D", & "E".
The "right" answer starts with a BOLDed and UNDERLINEd letter.

Example:

94. Test Question

A. answer A

B. answer B

C. answer C

D. answer D

E. answer E
Reply With Quote
  #2  
Old 05-02-2014, 02:56 AM
macropod's Avatar
macropod macropod is offline Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Windows 7 32bit Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[A-Z]."
    .Replacement.Text = ""
    .Font.Bold = False
    .Font.Underline = wdUnderlineNone
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    With .Duplicate
      If .Start = .Paragraphs.First.Range.Start Then
        .Paragraphs.First.Range.Text = vbNullString
      End If
    End With
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-02-2014, 03:01 AM
frustrated teacher frustrated teacher is offline Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Windows 7 64bit Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Office 2010 64bit
Novice
Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question
 
Join Date: May 2014
Posts: 12
frustrated teacher is on a distinguished road
Default

Hi! Thank you for such the quick response.

Your macro worked to a degree. It deleted all the unneccessary "answer letters" but still left the "answer choices".

This is what I'm getting now:

94. Test Question

answer A

B. answer B

answer C

answer D

answer E

with "B." being the right answer
Reply With Quote
  #4  
Old 05-02-2014, 03:10 AM
macropod's Avatar
macropod macropod is offline Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Windows 7 32bit Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The sample data in your first post implied the answer 'choice' and its text were in the same paragraph - and that's what I coded for. With data such as you described, all that would be left is:
94. Test Question
B. answer B

The only reason the answer text would remain is if it were not part of the same paragraph.

I'd rather not waste more time guessing what your document's layout is, so perhaps you could attach a document to a post with some truly representative data (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-02-2014, 03:19 AM
frustrated teacher frustrated teacher is offline Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Windows 7 64bit Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Office 2010 64bit
Novice
Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question
 
Join Date: May 2014
Posts: 12
frustrated teacher is on a distinguished road
Default Thank you for your patience

I have added a sample with the formatting from the document intact. I now realize that the text is embedded in a table. I appreciate your help in helping me with this issue!
Attached Files
File Type: docx sample multiple choice.docx (13.3 KB, 26 views)
Reply With Quote
  #6  
Old 05-02-2014, 03:22 AM
macropod's Avatar
macropod macropod is offline Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Windows 7 32bit Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

In that case, you could change:
.Paragraphs.First.Range.Text = vbNullString
to:
.Rows(1).Delete
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 05-02-2014, 03:37 AM
frustrated teacher frustrated teacher is offline Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Windows 7 64bit Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Office 2010 64bit
Novice
Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question
 
Join Date: May 2014
Posts: 12
frustrated teacher is on a distinguished road
Default

WOW thank you so much, you're awesome! That was exactly what I needed. You saved me so much work and time! ^_^
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Macro Needed to Insert Asnwer to A Question in Multiple Choice Format Question rsrasc Word VBA 7 03-28-2014 12:28 PM
Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question multiple choice question ENEMALI Word VBA 1 09-29-2013 09:05 PM
Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Linking multiple choice questions to answers Microsoftenquirer1000 Word 2 08-12-2012 02:49 PM
Linking multiple choice questions to answers Microsoftenquirer1000 Word 1 06-11-2012 06:53 AM
Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question Macro To Delete Instance across multiple slides. excelledsoftware PowerPoint 2 03-01-2012 07:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:35 AM.


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