Sub MOODLE_GIFT() Dim MyText As String Dim MyRange As Object iParcount = ActiveDocument.Paragraphs.Count Dim I, J, Question As Long J = 1 I = 1 Question = 1 Do ' Lay du lieu cua doan van Set MyRange = ActiveDocument.Paragraphs(J).Range ' Doan van dau tien la de bai, them tieu de cau hoi va dau ngoac nhon If I = 1 Then MyText = "::Question" & Question & "::" MyRange.InsertBefore (MyText) MyText = "{" & Chr(13) MyRange.InsertAfter (MyText) J = J + 1 iParcount = iParcount + 1 ' Do them 1 dong moi Set MyRange = ActiveDocument.Paragraphs(J).Range End If ' Doan van thu 2 den 5 la cac dap an, them dau nga If I = 2 Or I = 3 Or I = 4 Or I = 5 Then MyText = "~" MyRange.InsertBefore (MyText) End If ' Doan van cuoi cung them dau ngoac ket thuc cau hoi If I = 5 Then MyText = "}" & Chr(13) MyRange.InsertAfter (MyText) J = J + 1 iParcount = iParcount + 1 ' Do them 1 dong moi Set MyRange = ActiveDocument.Paragraphs(J).Range End If ' Cap nhat lai gia tri i the hien cau nao trong cau hoi trac nghiem I = I + 1 If I = 7 Then I = 1 Question = Question + 1 End If J = J + 1 Loop Until J > iParcount ' Thay the ~* thanh dau =: dap an With ActiveDocument.Content.Find .ClearFormatting With .Replacement .ClearFormatting .Font.Bold = False End With .Execute FindText:="~*", ReplaceWith:="=", Replace:=wdReplaceAll End With End Sub