Secondary Categories: 02-Malware


Description:

Declaring variables:

Dim myString As String
Dim myLong As Long 
Dim myPointer As LongPtr

If/Else statements:

Sub MyMacro()
Dim myLong As Long
 
myLong = 1 
 
If myLong < 5 Then
	MsgBox ("True")
Else 
	MsgBox ("False")
End If 
End Sub

For Loop:

Sub MyMacro()
For counter = 1 To 3 
	MsgBox ("Alert")
Next counter 
 
End Sub

The Document_Open will execute when the document is open. Which will trigger the β€œEnable Macros” security notification

Sub Document_Open()
 MyMacro
End Sub
Sub AutoOpen()
 MyMacro
End Sub
Sub MyMacro()
 MsgBox ("This is a macro test")
End Sub
 

This will create a child process under the word document:

Sub Document_Open()
 MyMacro
End Sub
Sub AutoOpen()
 MyMacro
End Sub
Sub MyMacro()
 Dim str As String
 str = "cmd.exe"
 Shell str, vbHide
End Sub
 

WinAPI functions in VBA

BOOL GetUserNameA( 
	LPSTR lpBuffer,
	LPDWORD pcbBuffer 
);
Function MyMacro()
 Dim res As Long
 Dim MyBuff As String * 256
 Dim MySize As Long
 MySize = 256
 
 res = GetUserName(MyBuff, MySize)
End Function

Resources:

TitleURL
placeholder

Also Check Out: