dynamic input from a text file pavement elevations

  • Thread starter Thread starter John Coon
  • Start date Start date
J

John Coon

Hi,

I'm looking for a sample that can insert a comma delimiter see sample. The
first entry is the station along a baseline and the second is the elevation
at that baseline location. What I'm trying to do is read a comma delimiter
file and have the routine load the centerline elevation column and then
populate the
remaining fields based on the fields above table. I have some experience
with vba in autocad but none in excel. I can create the command dialog to
point to the text file but I don't know how to direct it to the centerline
column. If I can get the data in the correct column my next question is how
can I make the routine dynamic so that if I change a value in the values
above the table and have it fire and repopulate the data.

Thank you for any comments or direction you can provide.

John Coon

'and then open the text file containing the station/elevation data
Dim dblSta as double
Dim dblelev as double
intInputFile = FreeFile()
Open "c:\temp\profile.txt" For Input As intInputFile

Do While Not EOF(intInputFile)
'read 2 sequential, delimited values from the input file and store them
as station/elevation data
Input #intInputFile, dblSta, dblelev

75 = width
1.5 = grade
100= percent divided by
0.015 = grade in decimal
1.125 = width x grade decimal, difference in elevation

75 1.5 100 0.015 1.125 1.5
Station Left Offset 3 Left Offset 2 Left Offset 1 Centerline Elevation
Right Offset 1 Right Offset 2
2952.63 0.00 0.00 22.75 23.87 0.00 0.00
2808.85 0.00 0.00 23.16 24.28 0.00 0.00
3389.09 0.00 0.00 24.16 25.28 0.00 0.00

sample:
2952.63, 287.63
2808.85, 309.59
3389.099, 309.59
 
Take a look at the split function. It takes a single line of input from your
CSV file (which you already have) and converts it into an array, which you
can deal with.

HTH
 
Jim,

Thanks I'll take a look at that function.
If I can split the text file how do I direct the split text elements to the
proper column?

Have a great day.
John Coon
 
Back
Top