Preset TXT document content format, just change one of the two values
Dc (1) the normal work, for example, the normal work exchange (2), (3), the power of this random transform is 123
CodePudding user response:
Don't understand what do you mean "automatic random add",Write files or to write code, you use the Open "file name" For Append As # 1, Open the file, Print # 1, & lt; Your values & gt; Can add write, remember the last Close # 1,
CodePudding user response:
Option Explicit
Sub RandomAppend (ByVal FileName As String)
Dim hFile As Integer
Dim As Long I
HFile=FreeFile ()
The Open FileName For Append As # hFile
Randomize
I=Int (Rnd () * 3) + 1
Select a Case I
Case 1: Print # hFile, the normal work of the "dc"
Case 2: Print # hFile, the normal work of the "communication"
Case 3: Print # hFile, "power"
End the Select
Close # hFile
End Sub
Private Sub Command1_Click ()
RandomAppend "D: \ temp \ 1. TXT"
End Sub