Malicious Office (OLE) / .DOC — malware analysis report

Static analysis result for SHA-256 aefa86e2f0cfc3cd…

MALICIOUS

Office (OLE) / .DOC

385.7 KB Created: 2010-08-07 10:00:00 Authoring application: Microsoft Office Word First seen: 2026-06-22
MD5: a82db353b3f79ba77840ace07f9bc1f0 SHA-1: 56bf53cb28686d8370fd283a02dcc2fab2b31a50 SHA-256: aefa86e2f0cfc3cddb4b494a71a5eac3dc295f221844397cf26411e691290f05
108 Risk Score

Heuristics 4

  • Clipboard command execution lure high SE_CLIPBOARD_COMMAND_LURE
    Document tells the user to copy or paste clipboard content into Run, PowerShell, cmd, or another shell-like execution context
  • VBA macros detected medium 2 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • GetObject call high OLE_VBA_GETOBJ
    GetObject call
    Matched line in script
    Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
    Path = Environ("APPDATA") & "\DDTN.dat" 'Duong dan chua file du lieu

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 30768 bytes
SHA-256: f2dba5d37c8d7f31f42cec43fd2bbb5f61dc2b08f8cda6083a219317f4cf5c48
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "1Normal.ThisDocument"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = True
Attribute VB_Customizable = True

Attribute VB_Name = "TronDe_Form"
Attribute VB_Base = "0{3FBAD793-1A6C-4D9E-A81D-0EFE22013B35}{D06EB29E-F6D8-4987-9974-F4E847253D90}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private Sub Cancel_cmd_Click()
Me.Hide
End Sub
Private Sub DaoDe_cmd_Click()
Dim TepMoi As Document
Const MyTab = 1.27 'Do dai Tab thut dau dong cho dap an (tinh theo don vi cm)
Dim BangTieuDe, BangTuLuan, BangTracNghiem As Table
Dim BangNguon(), BangDich(), BangTG(), DapAn1() As Integer
Dim BangDich1(4) As Byte
ReDim BangNguon(Me.SoCau)
ReDim BangDich(Me.SoCau)
ReDim BangTG(SoCauTracNghiem)
Set BangTieuDe = ActiveDocument.Tables(1)
Set BangTuLuan = ActiveDocument.Tables(2)
Set BangTracNghiem = ActiveDocument.Tables(3)
On Error GoTo Loi
Open Path For Input As #1
Line Input #1, MaKichHoat
Line Input #1, LoaiBanQuyen
Close #1
GoTo TronDe
Loi:
Close #1
Open Path For Output As #1
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem In colItems
    MaKichHoat = objItem.ProcessorId
Next
LoaiBanQuyen = 0 '0 la chua mua, 1 la mua loai 50.000, 2 la mua loai 100.000
Print #1, MaKichHoat
Print #1, LoaiBanQuyen
Close #1
TronDe:
If LoaiBanQuyen = 0 And Me.SoCau > 8 Then
  '  MsgBox "Ban quyen cua ban chi duoc tron toi da la 8 cau. Neu muon tron nhieu hon ban vui long dang ky! (Infomation->Nang cap)", vbInformation, "Thông báo"
   ' Exit Sub
End If
If LoaiBanQuyen = 1 And Me.SoCau > 30 Then
    MsgBox "Ban quyen cua ban chi duoc tron toi da la 30 cau. Neu muon tron nhieu hon ban vui long dang ky! (Infomation->Nang cap)", vbInformation, "Thông báo"
   ' Exit Sub
End If
On Error Resume Next
'Lay thong tin cho Bang nguon
ThoiGian = Timer 'Luu lai thoi gian de tinh thoi gian dao de
StatusBar = "Chuong trinh khoi tao du lieu de chuan bi dao de. Ban hay cho doi..."
n = 0 'Luu so cau khong bat buoc
m = 0 'Luu so cau bat buoc
Randomize 'Khoi tao bo tao so ngau nhien
For i = 1 To SoCauTracNghiem
    If Len(BangTracNghiem.Rows(5 * i - 4).Cells(2).Range.Text) = 2 Then 'Neu day khong la cau bat buoc
        n = n + 1
        BangTG(n) = i 'Lam cho BangTG chi chua cau khong bat buoc
    Else
        m = m + 1
        BangNguon(m) = i 'Lam cho BangNguon chi chua cau bat buoc
    End If
Next
For i = m + 1 To Me.SoCau
    t = Int(n * Rnd + 1)
    BangNguon(i) = BangTG(t)
    BangTG(t) = BangTG(n)
    n = n - 1
Next
Me.Hide
StatusBar = "Chuong trinh dang tien hanh tron de. Ban hay cho doi it phut..."
If Me.XoaDanhDauBatBuoc Then 'Neu co lua chon xoa danh dau cau bat buoc
    ActiveDocument.Tables(3).Columns(2).Select
    Selection.Delete
    ActiveDocument.Save
End If
If Me.TaoDapAn Then 'Neu co lua chon tao dap an
    Set TepMoi = Documents.Add 'Tao tep tin luu dap an cac ma de
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
        .Name = "Times New Roman"
        .Size = 14
        .Bold = False
        .Underline = False
        .Italic = False
    End With
    With ActiveDocument.PageSetup 'Page setup
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = CentimetersToPoints(1.5)
        .BottomMargin = CentimetersToPoints(1.5)
        .LeftMargin = CentimetersToPoints(2.5)
        .RightMargin = CentimetersToPoints(1.5)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.5)
        .FooterDistance = CentimetersToPoints(1.3)
        .PageWidth = CentimetersToPoints(21)
        .PageHeight = CentimetersToPoints(29.7)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionContinuous
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1
        .GutterPos = wdGutterPosLeft
    End With
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter 'Can chu DAP AN vao giua
    Selection.Font.Bold = True 'Dat dinh dang chu dam
    Selection.TypeText Text:=ChrW(272) & "ÁP ÁN"
    Selection.Font.Bold = False
    Selection.TypeParagraph
    Selection.TypeParagraph
    'Tao bang chua dap an
    If Not Me.TaoBangGhiKetQua Then 'Neu khong co lua chon tao bang ghi ket qua cho HS thi tao bang ket qua dang danh sach con neu khong thi tao bang ket qua o phan sau
        ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=Me.SoCau + 1, NumColumns:=Me.SoDe + 1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
        With Selection.Tables(1)
            If .Style <> "Table Grid" Then
                .Style = "Table Grid"
            End If
            .ApplyStyleHeadingRows = True
            .ApplyStyleLastRow = True
            .ApplyStyleFirstColumn = True
            .ApplyStyleLastColumn = True
        End With
        ActiveDocument.Tables(1).Select
        Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
        Selection.Columns.PreferredWidth = CentimetersToPoints(2)
        ActiveDocument.Tables(1).Rows(1).Cells(1).Range.Text = "Câu"
        For i = 1 To Me.SoCau
            ActiveDocument.Tables(1).Rows(i + 1).Cells(1).Range.Text = "Câu " & i
        Next
    End If
    TenKQ = ActiveDocument.Name 'Luu lai ten cua tap tin chua dap an
End If
'**********************BAT DAU DAO DE****************************
For j = 1 To Me.SoDe
    'Lay thong tin cho bang dich
    ReDim DapAn1(Me.SoCau) 'Bang chua y tra loi dung cho ma de nay
    MaDe = Format(Int(1000 * Rnd), "000") 'Tao ngau nhien ma de gom 3 so
    ReDim BangTG(Me.SoCau)
    For i = 1 To Me.SoCau
        BangTG(i) = BangNguon(i)
    Next
    n = Me.SoCau
    For i = 1 To Me.SoCau 'Dao ngau nhien cau
        t = Int(n * Rnd + 1)
        BangDich(i) = BangTG(t)
        BangTG(t) = BangTG(n)
        n = n - 1
    Next
    ReDim BangTG(4)
    Set TepMoi = Documents.Add
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
        .Name = "Times New Roman"
        .Size = 14
        .Bold = False
        .Underline = False
        .Italic = False
    End With
    With ActiveDocument.PageSetup 'Page setup
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = CentimetersToPoints(1.5)
        .BottomMargin = CentimetersToPoints(1.5)
        .LeftMargin = CentimetersToPoints(2.5)
        .RightMargin = CentimetersToPoints(1.5)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.5)
        .FooterDistance = CentimetersToPoints(1.3)
        .PageWidth = CentimetersToPoints(21)
        .PageHeight = CentimetersToPoints(29.7)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionContinuous
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1
        .GutterPos = wdGutterPosLeft
    End With
    ActiveWindow.View.TableGridlines = False 'Khong cho hien luoi cua bang
    ActiveWindow.View.ShowTextBoundaries = False 'Khong hien duong bao text
    BangTieuDe.Range.Copy
    Selection.Paste
    Selection.EndKey Unit:=wdStory
    Selection.TypeParagraph
    Selection.TypeParagraph
    If SoDeTuLuan <> 0 Then
        Selection.Font.Bold = True
        Selection.TypeText Text:="I. Ph" & ChrW(7847) & "n tr" & ChrW(7855) & "c nghi" & ChrW(7879) & "m khách quan"
        Selection.TypeParagraph
    End If
    Selection.EndKey Unit:=wdStory
    'Bat dau cho cac cau trac nghiem tu BangDich vao trong de
    For i = 1 To Me.SoCau
        BangTracNghiem.Rows(5 * BangDich(i) - 4).Cells(3).Range.Copy
        Selection.Paste
        ActiveDocument.Tables(2).Rows(5 * i - 4).Cells(1).Select
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        Selection.Font.Bold = True
        Selection.Font.Underline = False
        Selection.Font.Italic = False
        Selection.TypeText Text:="Câu " & i & ": "
        Selection.EndKey Unit:=wdStory
        'Dao y tra loi
        ReDim BangTG(4)
        n = 0 'So y duoc phep dao
        For k = 1 To 4
            If Len(BangTracNghiem.Rows(5 * BangDich(i) + k - 4).Cells(5).Range.Text) > 2 Then 'Neu day la y khong duoc dao
                BangDich1(k) = k
            Else
                BangDich1(k) = 0
                n = n + 1
                BangTG(n) = k
            End If
        Next
        For k = 1 To 4
            If BangDich1(k) = 0 Then
                t = Int(n * Rnd + 1)
                BangDich1(k) = BangTG(t)
                BangTG(t) = BangTG(n)
                n = n - 1
            End If
            If BangDich1(k) = DapAn(BangDich(i)) Then 'Neu day la y tra loi dung thi luu lai dap an nay
                DapAn1(i) = k 'Luu y tra loi dung cua ma de nay vao bang DapAn1
            End If
        Next
        For k = 1 To 4
            BangTracNghiem.Rows(5 * BangDich(i) + BangDich1(k) - 4).Cells(3).Range.Copy
            Selection.Paste
            ActiveDocument.Tables(2).Rows(5 * i - 4 + k).Cells(1).Select
            Selection.MoveLeft Unit:=wdCharacter, Count:=1
            Selection.Font.Bold = False
            Selection.Font.Underline = False
            Selection.Font.Italic = False
            Selection.TypeText Text:=Chr(64 + k) & ") " 'Dien A, B, C, D
            Selection.EndKey Unit:=wdStory
        Next
    Next
    'Bo duong vien cua bang tieu de
    ActiveDocument.Tables(1).Borders.InsideLineStyle = wdLineStyleNone
    ActiveDocument.Tables(1).Borders.OutsideLineStyle = wdLineStyleNone
    'Dat Tab cho cac cau trac nghiem mot cach hop ly
    For i = 1 To Me.SoCau
        ChiaTab4 = True 'Chia Tab 1 dong 4 dap an
        ChiaTab2 = True 'Chia Tab 1 dong 2 dap an
        For k = 1 To 4 'Tim cach chia Tab
            ActiveDocument.Tables(ActiveDocument.Tables.Count).Rows(k + 1).Select
            SoDong = Selection.Information(wdFirstCharacterLineNumber)
            Selection.EndKey Unit:=wdLine
            SoDong = Selection.Information(wdFirstCharacterLineNumber) - SoDong
            TGian = Selection.Information(wdHorizontalPositionRelativeToTextBoundary)
            If SoDong > 0 Or TGian > (16 - MyTab) * 14.17 Then
                ChiaTab2 = False
                ChiaTab4 = False
                Exit For
            End If
            If SoDong > 0 Or TGian > (15 - MyTab) * 7.1 Then
                ChiaTab4 = False
            End If
        Next
        ActiveDocument.Tables(ActiveDocument.Tables.Count).Rows(1).ConvertToText Separator:=wdSeparateByParagraphs, NestedTables:=False
        ActiveDocument.Tables(ActiveDocument.Tables.Count).Rows(4).Select
        Selection.MoveUp Unit:=wdLine, Count:=3, Extend:=wdExtend
        Selection.Rows.ConvertToText Separator:=wdSeparateByParagraphs, NestedTables:=False
        If ChiaTab4 Then 'Chia 4 Tab
            Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(MyTab), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
            Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints((17 + 3 * MyTab) / 4), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
            Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints((17 + MyTab) / 2), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
            Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints((51 + MyTab) / 4), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
            Selection.MoveLeft Unit:=wdCharacter, Count:=1
            Selection.TypeText Text:=vbTab
            For k = 1 To 3
                Selection.EndKey Unit:=wdLine
                Selection.Delete Unit:=wdCharacter, Count:=1
                Selection.TypeText Text:=vbTab
            Next
        ElseIf ChiaTab2 Then 'Chia 2 Tab
            Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(MyTab), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
            Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints((17 + MyTab) / 2), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
            Selection.MoveLeft Unit:=wdCharacter, Count:=1
            Selection.TypeText Text:=vbTab
            Selection.EndKey Unit:=wdLine
            Selection.Delete Unit:=wdCharacter, Count:=1
            Selection.TypeText Text:=vbTab
            Selection.EndKey Unit:=wdLine
            Selection.MoveRight Unit:=wdCharacter, Count:=1
            Selection.TypeText Text:=vbTab
            Selection.EndKey Unit:=wdLine
            Selection.Delete Unit:=wdCharacter, Count:=1
            Selection.TypeText Text:=vbTab
        Else 'Khong chia Tab
            Selection.ParagraphFormat.LeftIndent = CentimetersToPoints(MyTab)
        End If
    Next
    For i = 2 To ActiveDocument.Tables.Count 'Xoa cac dong trang sau cac bang
        ActiveDocument.Tables(i).Select
        Selection.MoveDown Unit:=wdLine, Count:=1
        Selection.Delete Unit:=wdCharacter, Count:=1
    Next
    If SoDeTuLuan <> 0 Then
        Selection.EndKey Unit:=wdStory
        Selection.Font.Bold = True
        Selection.Font.Underline = False
        Selection.Font.Italic = False
        Selection.TypeText Text:="II. Ph" & ChrW(7847) & "n t" & ChrW(7921) & " lu" & ChrW(7853) & "n"
        Selection.TypeParagraph
        BangTuLuan.Rows(j Mod SoDeTuLuan + 1).Cells(1).Range.Copy
        Selection.EndKey Unit:=wdStory
        Selection.Paste
        'Chuyen bang chua de tu luan thanh text
        ActiveDocument.Tables(ActiveDocument.Tables.Count).ConvertToText Separator:=wdSeparateByParagraphs, NestedTables:=False
    End If
    'Can deu hai ben cho doan van ban
    ActiveDocument.Tables(1).Select
    Selection.MoveDown Unit:=wdLine, Count:=2
    Selection.EndKey Unit:=wdStory, Extend:=wdExtend
    Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
    'Ghi chu Het vao cuoi
    Selection.EndKey Unit:=wdStory
    Selection.Font.Bold = False
    Selection.TypeText Text:="-----H" & ChrW(7871) & "t-----"
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    If Me.TaoBangGhiKetQua Then
        'Tao bang ghi ket qua cho HS lam bai
        Selection.TypeParagraph
        Selection.TypeParagraph
        Selection.TypeText Text:="B" & ChrW(7842) & "NG GHI K" & ChrW(7870) & "T QU" & ChrW(7842)
        For k = 1 To Int(Me.SoCau / 15) 'Dua vao so cau hoi de tao cac bang ghi dap an
            Selection.TypeParagraph
            'Tao bang 5 dong 16 cot
            ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:=16, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
            With Selection.Tables(1)
                If .Style <> "Table Grid" Then
                    .Style = "Table Grid"
                End If
                .ApplyStyleHeadingRows = True
                .ApplyStyleLastRow = True
                .ApplyStyleFirstColumn = True
                .ApplyStyleLastColumn = True
            End With
            'Ghi chu vao bang vua tao
            Selection.TypeText Text:="Câu"
            For t = 1 To 4 'Ghi cac phuong an A, B, C, D
                Selection.MoveDown Unit:=wdLine, Count:=1
                Selection.TypeText Text:=Chr(64 + t) & ")"
            Next
            Selection.MoveUp Unit:=wdLine, Count:=4
            For t = 1 To 15
                Selection.MoveRight Unit:=wdCell
                Selection.TypeText Text:=Format((k - 1) * 15 + t, "00")
                'Ghi cac ky tu O vao bang
                For Dong = 1 To 4
                    Selection.MoveDown Unit:=wdLine, Count:=1
                    Selection.InsertSymbol Font:="Wingdings 2", CharacterNumber:=-3943, Unicode:=True
                Next
                Selection.MoveUp Unit:=wdLine, Count:=4
            Next
            'Lam vua du lieu trong bang
            Selection.Tables(1).Select
            Selection.Tables(1).AutoFitBehavior (wdAutoFitContent)
            Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
            Selection.MoveDown Unit:=wdLine, Count:=1
            'Da tao xong 1 bang 15 cau
        Next
        If Me.SoCau Mod 15 <> 0 Then 'Tao bang chua dap an cua nhung cau con thua
            Selection.TypeParagraph
            ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:=1 + Me.SoCau Mod 15, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
            With Selection.Tables(1)
                If .Style <> "Table Grid" Then
                    .Style = "Table Grid"
                End If
                .ApplyStyleHeadingRows = True
                .ApplyStyleLastRow = True
                .ApplyStyleFirstColumn = True
                .ApplyStyleLastColumn = True
            End With
            'Ghi chu vao bang vua tao
            Selection.TypeText Text:="Câu"
            For t = 1 To 4 'Ghi cac phuong an A, B, C, D
                Selection.MoveDown Unit:=wdLine, Count:=1
                Selection.TypeText Text:=Chr(64 + t) & ")"
            Next
            Selection.MoveUp Unit:=wdLine, Count:=4
            For t = 1 To Me.SoCau Mod 15
                Selection.MoveRight Unit:=wdCell
                Selection.TypeText Text:=Format((k - 1) * 15 + t, "00")
                'Ghi cac ky tu O vao bang
                For Dong = 1 To 4
                    Selection.MoveDown Unit:=wdLine, Count:=1
                    Selection.InsertSymbol Font:="Wingdings 2", CharacterNumber:=-3943, Unicode:=True
                Next
                Selection.MoveUp Unit:=wdLine, Count:=4
            Next
            'Lam vua du lieu trong bang
            Selection.Tables(1).Select
            Selection.Tables(1).AutoFitBehavior (wdAutoFitContent)
            Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
            Selection.MoveDown Unit:=wdLine, Count:=1
        End If
    End If
    'Chuyen thanh font Times New Roman (trong de)
    ActiveDocument.Tables(1).Select
    Selection.MoveDown Unit:=wdLine, Count:=2
    Selection.EndKey Unit:=wdStory, Extend:=wdExtend
    Selection.Font.Name = "Times New Roman"
    Selection.Font.Size = 14
    Selection.EndKey Unit:=wdStory
    'Dat tieu de cho trang
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    If Selection.HeaderFooter.IsHeader = True Then
        ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
        ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.TypeText Text:=ChrW(272) & ChrW(7873) & " s" & ChrW(7889) & " " & MaDe & " ("
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
    Selection.TypeText Text:="/"
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
    Selection.TypeText Text:=")"
    Selection.WholeStory
    Selection.Font.Name = "Arial"
    Selection.Font.Size = 10
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
    'Dua dap an dung vao tap tin dap an (neu co lua chon tao dap an)
    If Me.TaoDapAn Then
        Windows(TenKQ).Activate 'Mo tap tin chua dap an ra
        If Not Me.TaoBangGhiKetQua Then 'Neu khong co lua chon tao bang ghi ket qua cho HS thi moi tao dap an dang danh sach
            ActiveDocument.Tables(1).Rows(1).Cells(j + 1).Range.Text = ChrW(272) & ChrW(7873) & " " & MaDe
            For k = 1 To Me.SoCau
                ActiveDocument.Tables(1).Rows(k + 1).Cells(j + 1).Range.Text = Chr(64 + DapAn1(k))
            Next
        Else 'Con neu khong thi tao dap an dang bang (cham bang bia duc lo)
            Selection.TypeParagraph
            Selection.TypeText Text:=ChrW(272) & ChrW(7873) & " s" & ChrW(7889) & " " & MaDe
            Selection.TypeParagraph
            For k = 1 To Int(Me.SoCau / 15) 'Dua vao so cau hoi de tao cac bang ghi dap an
                Selection.TypeParagraph
                'Tao bang 5 dong 16 cot
                ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:=16, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
                With Selection.Tables(1)
                    If .Style <> "Table Grid" Then
                        .Style = "Table Grid"
                    End If
                    .ApplyStyleHeadingRows = True
                    .ApplyStyleLastRow = True
                    .ApplyStyleFirstColumn = True
                    .ApplyStyleLastColumn = True
                End With
                'Ghi chu vao bang vua tao
                Selection.TypeText Text:="Câu"
                For t = 1 To 4 'Ghi cac phuong an A, B, C, D
                    Selection.MoveDown Unit:=wdLine, Count:=1
                    Selection.TypeText Text:=Chr(64 + t) & ")"
                Next
                Selection.MoveUp Unit:=wdLine, Count:=4
                For t = 1 To 15
                    Selection.MoveRight Unit:=wdCell
                    Selection.TypeText Text:=Format((k - 1) * 15 + t, "00")
                    'Ghi cac ky tu O vao bang
                    For Dong = 1 To 4
                        Selection.MoveDown Unit:=wdLine, Count:=1
                        If DapAn1((k - 1) * 15 + t) = Dong Then
                            Selection.InsertSymbol Font:="Wingdings 2", CharacterNumber:=-3944, Unicode:=True
                        Else
                            Selection.InsertSymbol Font:="Wingdings 2", CharacterNumber:=-3943, Unicode:=True
                        End If
                    Next
                    Selection.MoveUp Unit:=wdLine, Count:=4
                Next
                'Lam vua du lieu trong bang
                Selection.Tables(1).Select
                Selection.Tables(1).AutoFitBehavior (wdAutoFitContent)
                Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
                Selection.MoveDown Unit:=wdLine, Count:=1
                'Da tao xong 1 bang 15 cau
            Next
            If Me.SoCau Mod 15 <> 0 Then 'Tao bang chua dap an cua nhung cau con thua
                Selection.TypeParagraph
                ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:=1 + Me.SoCau Mod 15, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
                With Selection.Tables(1)
                    If .Style <> "Table Grid" Then
                        .Style = "Table Grid"
                    End If
                    .ApplyStyleHeadingRows = True
                    .ApplyStyleLastRow = True
                    .ApplyStyleFirstColumn = True
                    .ApplyStyleLastColumn = True
                End With
                'Ghi chu vao bang vua tao
                Selection.TypeText Text:="Câu"
                For t = 1 To 4 'Ghi cac phuong an A, B, C, D
                    Selection.MoveDown Unit:=wdLine, Count:=1
                    Selection.TypeText Text:=Chr(64 + t) & ")"
                Next
                Selection.MoveUp Unit:=wdLine, Count:=4
                For t = 1 To Me.SoCau Mod 15
                    Selection.MoveRight Unit:=wdCell
                    Selection.TypeText Text:=Format((k - 1) * 15 + t, "00")
                    For Dong = 1 To 4 'Ghi cac ky tu O vao bang
                        Selection.MoveDown Unit:=wdLine, Count:=1
                        If DapAn1((k - 1) * 15 + t) = Dong Then
                            Selection.InsertSymbol Font:="Wingdings 2", CharacterNumber:=-3944, Unicode:=True
                        Else
                            Selection.InsertSymbol Font:="Wingdings 2", CharacterNumber:=-3943, Unicode:=True
                        End If
                    Next
                    Selection.MoveUp Unit:=wdLine, Count:=4
                Next
                'Lam vua du lieu trong bang
                Selection.Tables(1).Select
                Selection.Tables(1).AutoFitBehavior (wdAutoFitContent)
                Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
                Selection.MoveDown Unit:=wdLine, Count:=1
            End If
        End If
        'Chuyen font trong tep DAP AN thanh Times New Roman
        Selection.WholeStory
        Selection.Font.Name = "Times New Roman"
        Selection.Font.Size = 14
        Selection.EndKey Unit:=wdStory
    End If
Next
ThongBao.Show
End Sub
Private Sub SpinButton1_SpinDown()
If Me.SoDe > 1 Then
    Me.SoDe = Me.SoDe - 1
End If
End Sub
Private Sub SpinButton1_SpinUp()
If Me.SoDe < 50 Then
    Me.SoDe = Me.SoDe + 1
End If
End Sub
Private Sub SpinButton2_SpinDown()
If Me.SoCau - SoCauBatBuoc > 0 And Me.SoCau > 1 Then
    Me.SoCau = Me.SoCau - 1
End If
End Sub
Private Sub SpinButton2_SpinUp()
If Me.SoCau - SoCauTracNghiem < 0 Then
    Me.SoCau = Me.SoCau + 1
End If
End Sub



Attribute VB_Name = "TronDe"
Public SoCauBatBuoc As Integer
Public SoCauTracNghiem As Integer
Public SoDeTuLuan As Integer
Public DapAn() As Integer 'Bang luu ket qua dung cua bang goc
Public Path As String
Sub DaoDe()
Path = Environ("APPDATA") & "\DDTN.dat" 'Duong dan chua file du lieu
ThoiGian = Timer 'Danh dau thoi gian de tinh thoi gian chuong trinh lam viec
StatusBar = "Chuong trinh dang lay thong tin cau hoi. Ban vui long cho doi it phut..."
'Bat dau lay so de tu luan
SoDeTuLuan = 0
For i = 1 To ActiveDocument.Tables(2).Rows.Count
    If Len(ActiveDocument.Tables(2).Rows(i).Cells(1).Range.Text) > 2 Then 'Neu o nay khong trong
        SoDeTuLuan = SoDeTuLuan + 1
    Else
        Exit For
    End If
Next
'Bat dau lay so cau trac nghiem va so cau bat buoc
SoCauTracNghiem = 0
SoCauBatBuoc = 0
ReDim DapAn(Int(ActiveDocument.Tables(3).Rows.Count / 5))
ReDim BangThongTin(Int(ActiveDocument.Tables(3).Rows.Count / 5))
For i = 1 To Int(ActiveDocument.Tables(3).Rows.Count / 5)
    If Len(ActiveDocument.Tables(3).Rows(5 * i - 4).Cells(3).Range.Text) > 2 Then 'Neu o nay khong trong
        SoCauTracNghiem = SoCauTracNghiem + 1
        For j = 1 To 4 'Tim dap an cua cau thu i
            DapAn(0) = 0 'Danh dau rang chua tim thay dap an dung cho cau thu i
            If Len(ActiveDocument.Tables(3).Rows(5 * i - 4 + j).Cells(4).Range.Text) > 2 Then 'Neu day la y tra loi dung
                DapAn(i) = j
                DapAn(0) = 1 'Danh dau rang da tim thay dap an dung cho cau thu i
                Exit For
            End If
        Next
        If DapAn(0) = 0 Then 'Neu cau thu i chua danh dau dap an dung thi dung lai
            h = MsgBox("Cau hoi thu " & i & " chua danh dau y tra loi dung. Ban hay xem lai.", vbInformation, "Thông báo")
            Exit Sub
        End If
    Else
        Exit For
    End If
    If Len(ActiveDocument.Tables(3).Rows(5 * i - 4).Cells(2).Range.Text) > 2 Then 'Neu o nay khong trong
        SoCauBatBuoc = SoCauBatBuoc + 1
    End If
Next
TronDe_Form.SoDe = 1
If SoCauBatBuoc > 0 Then
    TronDe_Form.SoCau = SoCauBatBuoc
Else
    TronDe_Form.SoCau = SoCauTracNghiem
End If
TronDe_Form.TaoDapAn = True
TronDe_Form.XoaDanhDauBatBuoc = False
TronDe_Form.TaoBangGhiKetQua = False
StatusBar = "Da lay xong thong tin cau hoi (" & Round(Timer - ThoiGian, 2) & " giay)"
TronDe_Form.Show
End Sub
Public Sub ThongTin()
ThongTin_Form.Show
End Sub
Public Sub AddQuestion() 'Them dong de nhap them cau trac nghiem
ActiveDocument.Tables(3).Rows(ActiveDocument.Tables(3).Rows.Count - 4).Select
Selection.MoveDown Unit:=wdLine, Count:=4, Extend:=wdExtend
Selection.Copy
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Paste
End Sub



Attribute VB_Name = "ThongTin_Form"
Attribute VB_Base = "0{F689C5ED-F2CE-42AD-8907-A2CBABDE9B1D}{2BF05561-F300-44F5-80ED-F0E2138DA376}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private Sub DangKy_cmd_Click()
Me.Hide
DangKySanPham.LoaiBQ = Left(DangKySanPham.LoaiBQ, 33) & LoaiBanQuyen
DangKySanPham.MaKichHoat = MaKichHoat & Chr(65 + LoaiBanQuyen)
DangKySanPham.Serial = ""
DangKySanPham.Show
End Sub
Private Sub Label1_Click()
Me.Hide
End Sub
Private Sub Label2_Click()
Me.Hide
End Sub
Private Sub Label3_Click()
Me.Hide
End Sub
Private Sub Label4_Click()
Me.Hide
End Sub
Private Sub Label5_Click()
Me.Hide
End Sub
Private Sub Label6_Click()
Me.Hide
End Sub
Private Sub LoaiBanQuyen_Click()
Me.Hide
End Sub
Private Sub LoaiBQ_Click()
Me.Hide
End Sub
Private Sub UserForm_Click()
Me.Hide
End Sub

Attribute VB_Name = "ThongBao"
Attribute VB_Base = "0{9AC10B9F-9716-4AD2-942C-E6C047708C5C}{171CCA21-BB1A-49EB-ACC9-5CCD9B278297}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private Sub Label1_Click()
Me.Hide
End Sub
Private Sub Label2_Click()
Me.Hide
End Sub
Private Sub Label3_Click()
Me.Hide
End Sub
Private Sub Label4_Click()
Me.Hide
End Sub
Private Sub OK_cmd_Click()
Me.Hide
End Sub
Private Sub UserForm_Click()
Me.Hide
End Sub