If you want to learn programming, you can try to explore the code of notepad. There are many related resources online for reference. However, if it is just for personal use, you can simply write a VBS script and perform the save operation by pressing Ctrl S.
The codes are as follows. Save them as corresponding file names. If you want to run, click start.vbs, and if you want to end, click stop.vbs
'********** start.vbs **********
Set s = WScript.CreateObject("Wscript.Shell")
Do
WScript.Sleep 1000*60 '1 min once
s.SendKeys "^s"
Loop
'******** stop.vbs *********
set ws=createobject("wscript.shell")
ws.run "taskkill /f /im wscript.exe"
If there is no special requirement, then just follow the rotation method:
A B C D E
Day 1 Morning shift Midnight shift Rest Rest
Day 2 Rest Morning shift Midnight shift Rest
Day 3 Rest Rest Morning shift Midnight shift Night shift
Day 4 Night shift Rest Rest Morning shift Mid-day shift
Day 5 Midnight shift Rest Rest Morning shift
================================================ =
Day 6 Morning shift Midnight shift Rest Rest
Day 7 Rest Morning shift Midnight shift Rest
Day 8 Rest Rest Morning shift Midnight shift Night shift
Day 9 Night shift Rest Rest Morning shift Mid-day shift
Day 10 Midnight shift Rest Rest Morning shift
================================================ =
......
It can be found that in a round of 5 days, the 6th day repeats the 1st day, the 7th day repeats the 2nd day,...
Let me first explain how to directly output the one-month schedule on the form!
Option Explicit
Private Sub Command1_Click()
Dim d(1 To 5) As String
Dim MaxDay As Integer
Dim i As Integer
Dim j As Integer
Dim LS As String
d(1) = "Morning shift"
d(2) = "Middle class"
d(3) = "Night Shift"
d(4) = "rest"
d(5) = "rest"
MaxDay = Val(InputBox("Please enter the number of days in the month!"))
Print "A", "B", "C", "D", "E"
For i = 1 To MaxDay
If i > 5 Then
j = i Mod 5
If j = 0 Then j = 5
Else
j = i
End If
Debug.Print j, d(j)
Print d(j),
If i Mod 5 = 0 Then
LS = d(1)
For j = 1 To 4
d(j) = d(j 1)
Next j
d(5) = LS
End If
Next i
End Sub
Place a text box text1 and a button command1
in the formcode show as below
Option Explicit
Private Sub Command1_Click()
Text1 = Paixu(Text1)
End Sub
Private Function Paixu(ByVal Str As String) As String
Dim AscCode() As Integer
Dim tCode As Integer
Dim n As Integer
Dim i As Integer, j As Integer
n = Len(Str)
ReDim AscCode(n)
For i = 1 To n
AscCode(i) = Asc(Mid(Str, i, 1))
Next i
For i = 1 To n - 1
For j = i 1 To n
'Less-than signs are sorted from large to small, and greater-than signs are sorted from small to large
If AscCode(i) tCode = AscCode(i)
AscCode(i) = AscCode(j)
AscCode(j) = tCode
End If
Next j
Next i
For i = 1 To n
Paixu = Paixu & Chr(AscCode(i))
Next i
End Function
When using it, just call the following function paixu directly. Chinese is also arranged in pinyin order (polyphonetic characters are different)
The above is the detailed content of VB text editing tool with auto-save function. For more information, please follow other related articles on the PHP Chinese website!