View Single Post
  #1   Report Post  
schwa schwa is offline
Junior Member
 
Posts: 1
Default Macro to edit test questions

Hi, I'm using a macro to edit a lot of test questions, I’m just showing two of them here as an example.
1- Paul found it much easier to use a pencil for taking notes
as he could .......... mistakes, which he made plenty of, very easily.
A) type B) erase C) deter
D) furnish E) release
2- You have to watch that market trader very ...........;
otherwise, he will sneakily throw a few rotten oranges in
amongst the good ones.
A) closely B) secretly C) violently
D) daringly E) placidly

Sub root()
Selection.Find.ClearFormatting
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToFirst
With Selection.Find
.Text = "A)"
.Forward = True
'.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
If Selection.Find.Found = True Then
Selection.MoveUp Unit:=wdParagraph, Count:=3, Extend:=wdExtend
Selection.Font.Bold = wdToggle
Selection.MoveDown Unit:=wdParagraph, Count:=2
End If
Loop
End Sub

Now, with this macro, I can turn the font of the question into bold, but the problem is that the macro above can not apply to every question because the number of lines may be different in every question so the values in the micro above (Count:=3 and Count:=2) should be changed or is there any universal way for this?

ALSO;
I want that macro to turn the question into a SINGLE PARAGRAPH, for which I’m currently using a separate macro:

Sub testnew()
'
' testnew Makro
'
'
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.TypeBackspace
Selection.TypeText Text:=" "
End Sub

I want to merge the two macros, if possible.
Sorry for the long post, and thank you for your attention