|
楼主 |
发表于 2019-6-22 16:20
|
显示全部楼层
不懂什么是uerform.我打开VBA有如下三个macro:
sheet1.ChangeColor
sheet1.PasswordBreaker
sheet1.RunRebuildTables
不知道三个是不是都有用。
由于电脑限制不能传文件,三个macro的代码我放一下,以End Sub做间隔:
Sub ChangeColor()
Dim WhichSheet As String
WhichSheet = Application.Caller
With ActiveSheet.Shapes(WhichSheet)
Select Case .Child
Case msoFalse
If .Fill.Visible = msoFalse Then .Fill.Visible = msoTrue
Select Case .Fill.ForeColor.RGB
Case RGB(255, 255, 255)
.Fill.ForeColor.RGB = RGB(255, 0, 0)
Case RGB(255, 0, 0)
.Fill.ForeColor.RGB = RGB(0, 0, 0)
Case Else
.Fill.ForeColor.RGB = RGB(255, 255, 255)
End Select
Case msoTrue
If .ParentGroup.Fill.Visible = msoFalse Then .Fill.Visible = msoTrue
Select Case .ParentGroup.Fill.ForeColor.RGB
Case RGB(255, 255, 255)
.ParentGroup.Fill.ForeColor.RGB = RGB(255, 0, 0)
Case RGB(255, 0, 0)
.ParentGroup.Fill.ForeColor.RGB = RGB(0, 0, 0)
Case Else
.ParentGroup.Fill.ForeColor.RGB = RGB(255, 255, 255)
End Select
End Select
End With
End Sub
Sub PasswordBreaker()
'Author JKZ
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub
Sub RunRebuildTables()
Dim ctrls As CommandBarControls
Dim ctrl As CommandBarControl
Dim ctrls2 As CommandBarControls
Dim ctrl2 As CommandBarControl
Set ctrls = Application.CommandBars.FindControls(, , , True)
For Each ctrl In ctrls
If ctrl.Caption = "F&luor FFD" Then
Set ctrls2 = ctrl.Controls
For Each ctrl2 In ctrls2
'Debug.Print ctrl2.Caption
If ctrl2.Caption = "Re&build Tables in Spreadsheet" Then
ctrl2.Execute
Exit Sub
End If
Next
End If
Next
End Sub
|
|