开发者

VBA text file parsing

I have to figure out a way to parse a text file in VBA this week and I was hoping I could get some guidance on how this would work.

The fileformat is similar to the example below (2 lines per relevant entry with no delimiters). Individual records are determined by the positions on the line:

005839998000017868XC9089
  002598DD930120000000000

My question is how could I tell ExcelVBA to to import characters 1-6 as an entry and 8-12 as another, etc? Then, how can I make sure that it is looking at every two lines as a related record? I then have to export each record on a line in s开发者_JAVA百科ome type of delimited file.

Any guidance on how to get started will be greatly appreciated.


Most of your question is answered in this other question Read lines from a text file but skip the first two lines

If you end up with a line in a string, you can use the mid() to break out individual fields and the left() function to tell you what kind of line you are on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜