授予特定用户帐户访问权限时出错

问题描述 投票:0回答:1

不明白为什么以下结果带有编译错误,请帮忙。

在VBA中遇到的问题,尝试创建具有适当访问权限的用户帐户访问权限并且略微降低标记

Sub CheckUser()
Dim UserRow, SheetCol As Long
Dim SheetNm As String
With Sheet1
.Calculate

If .Range("B8").Value = Empty Then 'Incorrect Username
MsgBox "Please enter a correct Username"
Exit Sub
End If

If .Range("B7").Value <> True Then 'Incorrect password
MsgBox "Please enter correct Password"
Exit Sub
End If

LoginForm.Hide
.Range("B5,B6").ClearContents
UserRow = .Range("B8").Value 'User row

For SheetCol = 7 To 19
SheetNm = .Cells(5, SheetCol).Value 'Sheet Name
If .Cells(UserRow, SheetCol).Value = "Ð" Then
Sheets(SheetNm).Unprotect "123"
Sheets(SheetNm).Visible = xlSheetVisible
End If

If .Cells(UserRow, SheetCol).Value = "Ï" Then
Sheets(SheetNm).Protect "123"
Sheets(SheetNm).Visible = xlSheetVisible

If .Cells(UserRow, SheetCol).Value = "x" Then Sheets(SheetNm).Visible = xlSheetVeryHidden
Next SheetCol
End With
End Sub

Sub CloseworkBook()
Sheet15 Activate
Dim WkSht As Worksheet
For Each WkSht In ThisWorkbook.Worksheets
If WkSht <> "Start" Then WkShy.Visible = xlSheetVeryHidden
Next WkSht
ThisWorkbook.Save
End Sub

以为我做得很好......猜不是

期待宏运行但它失败了

excel vba
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.