Hide my file as a string
Add a key: Extract
Add commondialog 1 to locate the txt file.
Add a list List 1 to use as an array.
Private Sub getData ()
my file = getfile pathname(common dialog 1," txt ")
LineRead my file
End joint
Function lineread (name path as string) as string.
List 1。 clear
Darken s as a string
Open the entered name path as # 1
Do until EOF( 1)
Line input # 1, s
List 1。 Additional item
ring
Close # 1
End function
Private subcommand 1_Click ()
If getData= ""then getData
Mark I as an integer
If the list 1. Count = then msgbox "All batches have been extracted": exit the sub.
I=int(rnd()*List 1.count)
Msgbox list 1. List (I) The result of your lottery is i.
List 1。 List (i) = ""
My file
End joint
Subwirtext (name path is a string)
Darken s as a string
Mark I as an integer
For i = 0 to List 1. List count-1
If the list 1. List (1) < > ""Then s = s+List 1. List (1)+vbCrLf
then
Open the output name path as # 1
Print number 1, s
Close # 1
s = " "
End joint
The function getFilePathName(dlgObj as the object and setFilter as the string) is used as the string.
Add commondialog 1
Go to error when error occurs.
Using dlgObj
. DialogTitle = "Please specify a folder"
. Filter = "Specify file (*."&; setFilter & amp")|*."& ampsetFilter
. ShowOpen
getFilePathName =。 filename
End with ...
Exit function
Error:
MsgBox "You have not selected a file or there is no file in the folder"&; Set filter & "file"
End function
Private subcommand 3_Click ()' Save
My file
End joint
Zhang