How could i convert the following Sequential File coding to FSO File Coding ?

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
684
Hello

If anyone could just help me to convert the following Sequential File coding to FSO coding.

Will the same logic apply as RipTutorial Link

If your Reply is "YES" for below coding which could be quite equivalent to above link code then will work on it and move ahead.
ElseIf your Reply is "NO" or Partly agreeing then will appreciate your help with FSO coding

What i need is to overwrite the txtFilename2 with details of txtFilename and some added new data but with FSO method
VBA Code:
Private Sub Sequential_Result()

Dim txtfilename As String, txtfilename2 As String
Dim strDataTxtFile As String, lineCount As Integer

txtfilename = "C:\NimishK\1-Trial.txt"
txtfilename2 = "C:\NimishK\1A-Trial.txt"

Open txtfilename For Input As #1
  Open txtfilename2 For Output As #2
      While Not EOF(1)
        Line Input #1, strDataTxtFile
        lineCount = lineCount + 1
         Print #2, strDataTxtFile 
      Wend
         Print #2, vbCrLf
         Print #2, txtBox4.Text
 Close #2
Close #1
End Sub

Thanks
NimishK
 
question : why using FSO as VBA has already all the necessary or I missed something ?‼
Although it will not generate any errors nor display them unless and until
For eg if you would like to rename the File name with Name Command as this demands the closure of the file.

MVPs would be better Gurus to illuminate some light on your question and on my reply to your question

NimishK
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
According to the code sample as VBA can do exactly the same without any error neither displaying anything so I do not see any reason to take the FSO path …​
 
Upvote 0
According to the code sample as VBA can do exactly the same without any error neither displaying anything so I do not see any reason to take the FSO path …
You are right

ie Why I wanted to have the coding as per FSO from Sequential method.
I dont know whether FSO method has more outcomes then the Sequential method. if yes then wouldn't it be better to upgrade to FSO mehtod.

NimishK
636
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top