|
Private Sub userset_Click()
Dim oldname As String, new1 As String, new2 As String, oldwore As Integer
x: oldname = Application.inputbox("请输入原用户名")
oldword = Application.inputbox("请输入密码")
If oldname <> Right(Names("username").RefersTo, Len(Names("username").RefersTo) - 1) Or oldword <> Right(Names("password").RefersTo, Len(Names("password").RefersTo) - 1) Then
If MsgBox(prompt:="用户名或密码不正确", Buttons:=vbRetryCancel) = vbRetry Then
GoTo x
Else
Exit Sub
End If
End If
y: new1 = Application.inputbox("请输入新用户名")
If Len(new1) <> 4 Then
If MsgBox("用户名须4位", Buttons:=vbRetryCancel) = vbRetry Then
GoTo y
Else
Exit Sub
End If
End If
new2 = Application.inputbox("请确认新用户名")
If new1 = new2 Then
Names("username").RefersTo = "=" & new1
ThisWorkbook.Save
Else
MsgBox "两次输入结果不一致,改名失败"
End If
End Sub
大神们帮看看这段代码有什么问题吗?谢谢
|
|