- UID
- 56839
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-6-9
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
以下为程序内容
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 = "文档密码"
Label1.Refresh
Text1.Text = pass
wd.Visible = True
cmdopendoc.MousePointer = 0
Exit Sub
End If
Next I
Next J
Next K
MsgBox "密码位数不对,请重新输入"
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 |
|