Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading table with vb6 2

Status
Not open for further replies.

tmangin

Programmer
Oct 29, 2003
16
US
Hi,
I need to write code that will open a file, either in Word or Excel, read through the table and when it finds the number it's looking for, grabs the corresponding text and returns it to the code to be further manipulated. Any help or suggestions would be greatly appreciated!
Thanks!
 
This is probably a non-starter using a Word/Excel file.
Could the source file be a simple text file?

Without sight of the data, no-one will be able to give you any useful code.
 
JeffTullin,
Thanks for your reply. I'm not really sure that I follow what you said, though. What does non-starter mean? Also, what data do you need to see? I will be more than happy to provide you with it. The source file cannot be a text file because it has to be set up as some type of table-so that, for example, the ID 1625 corresponds with the name Tracy Mangin. I need to be able to search for that particular ID and upon finding it, grab "Tracy Mangin" and bring that value back to my code. Does this make more sense?
Thanks!
 
Look at the Word object library. You can get good examples of using VB in Word by recording a Macro and editing it to suit.

While you're in the VB code editor, the Help file for VBA is immediately available. Most of the code recorded by the macro will cut& paste into VB. If you get specific problems come back to us with some code, and a bit more detail of your requirement.

Same applies to Excel.

You should also read faq222-2244 to find ways of getting better answers in general.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
A few suggestions-

You can use a text file - Give it a fixed width format or tab / comma delimited and parse it a row at a time.
OR
You can use an Access database - Set up a table with the number / text you need and run a DLOOKUP or SELECT query to find the data.

While you could use Word or Excel, I don't believe either are particularly suited to your purpose.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top