Select output TXT path TXT form of input: each row of X, Y, Z Select export TXT path TXT form for export: each row of X, Y, Z
CodePudding user response:
Fyi:
Set fs=CreateObject (" Scripting. FileSystemObject ") : _ Set a=fs. CreateTextFile (" c: \ alltext TXT ", True) : _ Aleem walji riteLine (CStr (X) + ", "+ CStr (Y) +", "+ CStr (Z) : _ A.C lose: _ Set a=Nothing: _ Set the fs=Nothing: _
CodePudding user response:
The teacher look at me this, how can I read this file to change
Private Sub Command1_Click ()
With CommonDialog1 . DialogTitle="please select a file" . The Filter="text file | *. TXT" . CancelError=False . ShowOpen Text1) Text=) FileName End With
Dim STR As String Dim As Double B Dim As Double L Dim H As Double Dim canshu1 As Double Dim canshu2 As Double
Open "Filer For Input As # 1 Do Until EOF (1) The Line Input # 1, STR Canshu1=InStr (STR, ", ") B=Mid (STR, 1 x1-1) Canshu2=InStr (x1 + 1, STR, ", ") L=Mid (STR, x1 + 1, x2 - x1-1) H=Mid (STR, x2 + 1) Loop Close # 1
CodePudding user response:
Teacher, I understand this may not have the above said 1. Open the TXT file path through Command1 selection 2. Then read the selected TXT file (format each row are X, Y, Z) 3. Then each row of the XYZ to function as a set of data computing 4. Save the TXT file path through Command2 selection 5. Save the format of the ditto
The small white with VB6.0 by use
CodePudding user response:
1. When using CommonDialog CancelError attribute assignment to False, 9 as above are small white; After the CancelError set to False, in the "processing", nor the return value judgment, 100% is small white! If the CancelError set to False, after the "dialog" return, you must determine whether the FileName attribute value is empty string! Suggest the building Lord see a recent post in this BBS: http://bbs.csdn.net/topics/392164300
2. The "open file" statement of you write wrong! Open "Filer For Input As # 1 the result is" Open "in the current directory in the file named Filer", The "open file", to the public before the dialog box to return the result without any direct association; Because it is "Input" mode to open the file, the file does not exist when still can cause a runtime error, Should be Open CommonDialog. The FileName For Input As # 1
3. If you read the file data, to ensure "format is correct, specification," So "split data needn't so much Instr, Mid function to handle, such as Dim arrData () as string ..... Open...... Do The line Input # 1, STR If (" "=STR) Then Exit the Do ArrData=(STR, ", "https://bbs.csdn.net/topics/Split ........ This time, arrData (0) to arrData (2), each line is the corresponding X, Y, Z "string data values,
Temporary don't want to say... To modify the code yourself,