View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Varun Varun is offline
external usenet poster
 
Posts: 37
Default How to put lines with certain text (from a file) in an array

Guys,

I'd like to open and parse a file such that when I parse, only lines with
certain text in them get included into my array. How can I accomplish this?
For example, let say that file contents are as follows:

text in line 1
text in line 2
layer_1
layer_2
layer_3

I'd like to save the lines with layer_1, layer_2, and layer_3 in my array
named line.

Here's what I have so far - what should I do next?

Sub geomsasciiparse()

Dim Buf() As String
Dim logical_layer As Variant
Dim line() As String

Dim objFSO As Object
Dim objGeomsAsciiFile As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objGeomsAsciiFile = objFSO.OpenTextFile(MentDesContPath & "\geoms_ascii")
strBuffer = objGeomsAsciiFile.Readline

Do While Not objGeomsAsciiFile.AtEndOfStream

If InStr(strBuffer, "layer") = 1 Then




End If

Thanks for help.