I have a excel workbook report which is view by 5 persons. This report has 10 sheets, 9 of which are hidden using Sheets("Sheet2-10").Visible = xlVeryHidden
.
我有一份excel工作簿报告,可供5人查看。此报告有10张,其中9张是使用表格隐藏的(“Sheet2-10”)。Visible = xlVeryHidden。
However, my worksheet is not secure because people can unhide worksheets 2 to 10 by using Sheets("Sheet2-10").Visible = true
(e.g. called from another workbook).
但是,我的工作表并不安全,因为人们可以使用Sheets(“Sheet2-10”)取消隐藏工作表2到10. Visible = true(例如从另一个工作簿调用)。
How do I protect my worksheet against someone trying to do this?
如何保护我的工作表免受试图这样做的人的影响?
3 个解决方案
#1
0
This doesn't completely solve your issue, but as an FYI, Excel allows you to name sheets beginning with a quotation mark followed by an apostrophe and then letters or anything else. So you could have a sheet named "'Sheet1. If you try Worksheets(""'Sheet1").Visible
, you get a compiler error. Users could still call it by index number however.
这并不能完全解决您的问题,但作为一个FYI,Excel允许您命名以引号开头,后跟撇号,然后是字母或其他任何内容的工作表。所以你可以有一个名为“'Sheet1的工作表。如果你尝试工作表(”“'Sheet1”)。可见,你得到一个编译器错误。然而,用户仍然可以通过索引号来调用它。
#2
0
I think it's easy man. you just need to protect your VBA code with a password:
我觉得这很容易。您只需要使用密码保护您的VBA代码:
With this protection noone can see Microsoft Excel Object. So now, you just need to change your veryHidden sheet name to an awful name - hash name. like Sheets("FFJAR31GMCJ4ASAL8PYXXFE")
有了这种保护,没有人可以看到Microsoft Excel对象。所以现在,您只需要将您的非常隐藏的工作表名称更改为一个糟糕的名称 - 哈希名称。喜欢Sheets(“FFJAR31GMCJ4ASAL8PYXXFE”)
To make you like easier to code, you can set sheet's name in a constant.
为了使您更容易编码,可以将工作表的名称设置为常量。
Example:
Const MY_HIDDEN_SHEET As String = "FFJAR31GMCJ4ASAL8PYXXFE"
Sub f()
MsgBox "My hidden sheet name is " & MY_HIDDEN_SHEET
End Sub
#3
0
Just protect your workbook structure:
只需保护您的工作簿结构:
#1
0
This doesn't completely solve your issue, but as an FYI, Excel allows you to name sheets beginning with a quotation mark followed by an apostrophe and then letters or anything else. So you could have a sheet named "'Sheet1. If you try Worksheets(""'Sheet1").Visible
, you get a compiler error. Users could still call it by index number however.
这并不能完全解决您的问题,但作为一个FYI,Excel允许您命名以引号开头,后跟撇号,然后是字母或其他任何内容的工作表。所以你可以有一个名为“'Sheet1的工作表。如果你尝试工作表(”“'Sheet1”)。可见,你得到一个编译器错误。然而,用户仍然可以通过索引号来调用它。
#2
0
I think it's easy man. you just need to protect your VBA code with a password:
我觉得这很容易。您只需要使用密码保护您的VBA代码:
With this protection noone can see Microsoft Excel Object. So now, you just need to change your veryHidden sheet name to an awful name - hash name. like Sheets("FFJAR31GMCJ4ASAL8PYXXFE")
有了这种保护,没有人可以看到Microsoft Excel对象。所以现在,您只需要将您的非常隐藏的工作表名称更改为一个糟糕的名称 - 哈希名称。喜欢Sheets(“FFJAR31GMCJ4ASAL8PYXXFE”)
To make you like easier to code, you can set sheet's name in a constant.
为了使您更容易编码,可以将工作表的名称设置为常量。
Example:
Const MY_HIDDEN_SHEET As String = "FFJAR31GMCJ4ASAL8PYXXFE"
Sub f()
MsgBox "My hidden sheet name is " & MY_HIDDEN_SHEET
End Sub
#3
0
Just protect your workbook structure:
只需保护您的工作簿结构: