Student Corner

BACK

Break Microsoft Word Password

As we know, Microsoft Office is closed to VB and it's scripts were wrote by VBA. Hence, we can find MS Word password by VB.
  1. Start VB
  2. Save as Password
  3. Frame name as FrmMain
  4. Microsoft Word8.0 Object Library ( let say, Office 2000 then Microsoft Word9.0 Object Library )
  5. Select Active X
  6. Microsoft Windows common controls -2.5(sp2)
  7. Code as below

Private Sub cmdopendoc_Click()

Dim wd As New Word.Application

Dim strpath As String

Dim pass As String

Dim J, K, Pass_long As Integer

Dim Max_num, Min_num, I As Long

strpath = File1.Path & "\" & File1.FileName

On Error Resume Next

 

Pass_long = Val(Text2.Text)

Max_num = 10 ^ Val(Text2.Text)

Min_num = 10 ^ (Val(Text2.Text) - 1)

Flag = 0

For K = 0 To Pass_long - 1

Max_num = 10 ^ (Pass_long - K)

Min_num = 10 ^ (Pass_long - (K + 1))

For J = 0 To Pass_long - 1

cmdopendoc.MousePointer = 11

For I = IIf(Pass_long - K = 1, 0, Min_num) + J To Max_num Step Pass_long

Text1.Text = pass

Text1.Refresh

pass = String(K, "0") & I

Flag = wd.Documents.Open(FileName:=strpath, passworddocument:=pass)

If Flag <> 0 Then
Label1.Caption = "Password"

Label1.Refresh

Text1.Text = pass

wd.Visible = True

cmdopendoc.MousePointer = 0

Exit Sub

End If

Next I

Next J

Next K

MsgBox "Wrong Passwrod, re-enter"

End Sub


Private Sub cmdquit_Click()

End

End Sub


Private Sub Dir1_Change()

File1.Path = Dir1.Path

End Sub


Private Sub Drive1_Change()

Dir1.Path = Drive1.Drive

End Sub


Private Sub File1_DblClick()

Call cmdopendoc_Click

End Sub

www.often.tk 2004