Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/File-input-output/VBA/file-input-output.vba
Normal file
27
Task/File-input-output/VBA/file-input-output.vba
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
Option Explicit
|
||||
|
||||
Sub Main()
|
||||
Dim s As String, FF As Integer
|
||||
|
||||
'read a file line by line
|
||||
FF = FreeFile
|
||||
Open "C:\Users\" & Environ("username") & "\Desktop\input.txt" For Input As #FF
|
||||
While Not EOF(FF)
|
||||
Line Input #FF, s
|
||||
Debug.Print s
|
||||
Wend
|
||||
Close #FF
|
||||
|
||||
'read a file
|
||||
FF = FreeFile
|
||||
Open "C:\Users\" & Environ("username") & "\Desktop\input.txt" For Input As #FF
|
||||
s = Input(LOF(1), #FF)
|
||||
Close #FF
|
||||
Debug.Print s
|
||||
|
||||
'write a file
|
||||
FF = FreeFile
|
||||
Open "C:\Users\" & Environ("username") & "\Desktop\output.txt" For Output As #FF
|
||||
Print #FF, s
|
||||
Close #FF
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue