1

I have to replace a header with my new header value and footer needs to be removed.

Input:

Header
Value1||Value2|Value3|Value4
Value7|Value3||Value1|Value1
Value1|Value9|Value1||Value1
Value1||Value1|Value1|Value1
Value1||Value1|Value1|Value6
Footer

I need like below:

NewHeader
Value1||Value2|Value3|Value4
Value7|Value3||Value1|Value1
Value1|Value9|Value1||Value1
Value1||Value1|Value1|Value1
Value1||Value1|Value1|Value6

The way I am trying is:

Set oFso = CreateObject("Scripting.FileSystemObject")
Set oFile = oFso.OpenTextFile(filePath, 1, True)
strContents = Split(oFile.ReadAll, vbCrLf)
For i=0 To UBound(strContents)
   strContents(0) 'I get header and replace with my new header
Next

but strContents(0) returns entire value from the text file. How this can be handled?

4

1 に答える 1