Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Read data from one opened text file and write to another text file without
closing First text file. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Depends what you want to do, but here's one example:
Private Sub CommandButton1_Click() Dim FileRead As Long Dim FileWrite As Long Dim TempStr As String Const ReadFileName As String = "C:\ReadText.txt" Const WriteFileName As String = "C:\WriteText.txt" FileRead = FreeFile Open ReadFileName For Input As #FileRead FileWrite = FreeFile Open WriteFileName For Output As #FileWrite 'Or maybe 'Open WriteFileName For Append As #FileWrite Do While Not EOF(FileRead) Input #FileRead, TempStr 'Do something with the string TempStr = "Read value: " & TempStr 'Write out Write #FileWrite, TempStr 'Or maybe use Print Loop Close #FileRead Close #FileWrite End Sub NickHK "Lotuxel" wrote in message ... Read data from one opened text file and write to another text file without closing First text file. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "NickHK" wrote: Depends what you want to do, but here's one example: Private Sub CommandButton1_Click() Dim FileRead As Long Dim FileWrite As Long Dim TempStr As String Const ReadFileName As String = "C:\ReadText.txt" Const WriteFileName As String = "C:\WriteText.txt" FileRead = FreeFile Open ReadFileName For Input As #FileRead FileWrite = FreeFile Open WriteFileName For Output As #FileWrite 'Or maybe 'Open WriteFileName For Append As #FileWrite Do While Not EOF(FileRead) Input #FileRead, TempStr 'Do something with the string TempStr = "Read value: " & TempStr 'Write out Write #FileWrite, TempStr 'Or maybe use Print Loop Close #FileRead Close #FileWrite End Sub NickHK "Lotuxel" wrote in message ... Read data from one opened text file and write to another text file without closing First text file. Hi Nick HK, Thanks alot ! Great!. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
When i open excel file it takes time to open | Excel Discussion (Misc queries) | |||
Can Excel open a new application every time you open a file? | Setting up and Configuration of Excel | |||
How do I stop Excel from closing the open file each time I open a. | Setting up and Configuration of Excel | |||
Desktop shortcut to a named Excel file - every time I open it adds a "1" to the file name - how to disable? | Setting up and Configuration of Excel | |||
Excel VBA - open text file, replace text, save file? | Excel Programming |