word VBA 以下代码实现文本信息的隐藏和提取,可以隐藏,但是无法正确提取,请各路大神指教如何修改 30
信息隐藏Subopenfile()DimbAsByteDimiAsIntegerDima,lAsStringOpen"C:\Users\Administrator\Des...
信息隐藏
Sub openfile()
Dim b As Byte
Dim i As Integer
Dim a, l As String
Open "C:\Users\Administrator\Desktop\VBA\密文.txt" For Binary As #256
l = LOF(256)
For i = 1 To l
Get #256, , b
a = b Mod 2
If (a = 0) And (b <> 0) Then
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.Font
.Scaling = 110
End With
End If
If b = 0 Then
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.Font
.Scaling = 110
End With
End If
Selection.MoveRight
b = b \ 2
Next i
Close #256
End Sub
信息提取
Sub newfile()
Dim b As Byte
Dim i, j As Integer
Dim s As String
Open "C:\Users\Administrator\Desktop\VBA\解密文档.txt" For Binary As #257
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
With Selection.Characters
s = .Count
End With
Selection.HomeKey
For j = 1 To s \ 8
b = 0
For i = 1 To 8
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.Font
If .Scaling = 100 Then
b = b + 2 ^ (i - 1)
End If
End With
Selection.MoveRight
Next i
If b <> 255 Then
Put #257, , b
End If
Next j
Close #257
End Sub 展开
Sub openfile()
Dim b As Byte
Dim i As Integer
Dim a, l As String
Open "C:\Users\Administrator\Desktop\VBA\密文.txt" For Binary As #256
l = LOF(256)
For i = 1 To l
Get #256, , b
a = b Mod 2
If (a = 0) And (b <> 0) Then
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.Font
.Scaling = 110
End With
End If
If b = 0 Then
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.Font
.Scaling = 110
End With
End If
Selection.MoveRight
b = b \ 2
Next i
Close #256
End Sub
信息提取
Sub newfile()
Dim b As Byte
Dim i, j As Integer
Dim s As String
Open "C:\Users\Administrator\Desktop\VBA\解密文档.txt" For Binary As #257
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
With Selection.Characters
s = .Count
End With
Selection.HomeKey
For j = 1 To s \ 8
b = 0
For i = 1 To 8
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection.Font
If .Scaling = 100 Then
b = b + 2 ^ (i - 1)
End If
End With
Selection.MoveRight
Next i
If b <> 255 Then
Put #257, , b
End If
Next j
Close #257
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询