C
christophercbrewster via OfficeKB.com
I have some code working quite well but it includes some clunky code that I'd
like to do in a better way. There's a text file containing a tab-delimited
table of strings. The way it works now is to copy the file contents into a
Word scratch document and convert the tabbed table to a Word table. Then it
searches for a flag in column 1 and uses strings in columns 2 and 3 to do
some processing.
It seems that the real way to do this is to split the tabbed table to a 2-D
array. Then search the elements to perform this sequence:
1. Look for the flag string in column 1
2. When the flag is found, change that element's value to empty
3. Read the values of elements 2 and 3 in the same row
4. [further processing]
5. Loop to find next flag
So my questions are:
- Is there a good way to make a tabbed text table into a 2-D character array,
without having to use Word's table facility?
- Is there a good way to quickly search an array for an element and then work
with related elements? It would be nice to do this without a loop that
increments through the rows and does "if element value equals search string,
then do such-and-such". I'd rather do something that's closer to "find the
next flag and do such-and-such".
Thanks for advice.
--
Christopher Brewster
Lockheed Martin, Eagan MN
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200812/1
like to do in a better way. There's a text file containing a tab-delimited
table of strings. The way it works now is to copy the file contents into a
Word scratch document and convert the tabbed table to a Word table. Then it
searches for a flag in column 1 and uses strings in columns 2 and 3 to do
some processing.
It seems that the real way to do this is to split the tabbed table to a 2-D
array. Then search the elements to perform this sequence:
1. Look for the flag string in column 1
2. When the flag is found, change that element's value to empty
3. Read the values of elements 2 and 3 in the same row
4. [further processing]
5. Loop to find next flag
So my questions are:
- Is there a good way to make a tabbed text table into a 2-D character array,
without having to use Word's table facility?
- Is there a good way to quickly search an array for an element and then work
with related elements? It would be nice to do this without a loop that
increments through the rows and does "if element value equals search string,
then do such-and-such". I'd rather do something that's closer to "find the
next flag and do such-and-such".
Thanks for advice.
--
Christopher Brewster
Lockheed Martin, Eagan MN
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200812/1