As mentioned in title, what I did was:
Private Sub Workbook_Open()
Dim ws As Worksheet
Dim pwd As String
pwd = "jfm" ' Put your password here
For Each ws In Worksheets
ws.Protect Password:=pwd, UserInterFaceOnly:=True
Next ws
End Sub
But what I want is:
Thanks in advance.
Something like:
Dim StartTime As Double
StartTime = Timer
Dim i As Integer
Do Until False
'if 5 seconds have elapsed, exit loop
If CInt(Timer - StartTime) > 5 Then Exit Do
Loop
MsgBox "Finished after " & CInt(Timer - StartTime) & " seconds"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.