如何用VBA编写限制时间的使用
若以下回答无法解决问题,邀请你更新回答
1个回答
展开全部
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
rem 代码功能:打开工作簿40分钟后,对工作表进行加密保护:密码mPwd
rem 以下代码,放到thisworkbook代码窗格中
Private Sub Workbook_Open()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.ProtectContents Then sh.Unprotect "mPwd"
Next
Application.OnTime Now + TimeValue("0:40:00"), "abc"
End Sub
rem 以下代码,放到模块中
Sub abc()
Dim sh As Worksheet
application.DisplayAlerts=false
For Each sh In ThisWorkbook.Worksheets
If Not sh.ProtectContents Then sh.Protect "mPwd"
Next
thisworkbook.save
application.DisplayAlerts=true
End Sub
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
rem 代码功能:打开工作簿40分钟后,对工作表进行加密保护:密码mPwd
rem 以下代码,放到thisworkbook代码窗格中
Private Sub Workbook_Open()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.ProtectContents Then sh.Unprotect "mPwd"
Next
Application.OnTime Now + TimeValue("0:40:00"), "abc"
End Sub
rem 以下代码,放到模块中
Sub abc()
Dim sh As Worksheet
application.DisplayAlerts=false
For Each sh In ThisWorkbook.Worksheets
If Not sh.ProtectContents Then sh.Protect "mPwd"
Next
thisworkbook.save
application.DisplayAlerts=true
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询