我有这个代码:
Private Sub Workbook_Open()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Protect Password:="Wordpass", _
UserInterFaceOnly:=True
Next wSheet
End Sub
它保护工作簿中的所有工作表,但允许宏运行。
但是,这段代码:
wb.RefreshAll 'I've declared and set wb accordingly.
即使UserIntergFaceOnly
设置为. 也不执行True
。