Re: Fastest way to read data to populate combo controls?



If the OP were use ADO, he would be better off to treat the original Excel
as a store, and skip the intermediate 'text' file. The only real reason to
keep the intermediate is because the 'business logic' is already written.

So there is a way I can read a closed Excel file directly into the
combo contols of my form at load?

Ed



On Sep 19, 1:04 pm, "Ralph" <nt_consultin...@xxxxxxxxx> wrote:
"That Guy" <i_pow...@xxxxxxxxxxx> wrote in message

news:69af684f-d6d8-46fd-9085-05c46e40587c@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



On Sep 15, 12:40 pm, Ed from AZ <prof_ofw...@xxxxxxxxx> wrote:
When my VB6 app opens, the Form.Load code opens a document, reads the
info into six arrays, and then uses these arrays to populate six
combobox controls.  The info in question are "attributes" assigned to
a folder of Word documents; through the combos, I select an attribute
and the VB app opens that document.

At the moment I'm using a Word document to hold the info, because I
have the info in separate tables and I can iterate through the Tables
collection to make sure the info gets into the correct array.  I close
the doc, but keep the Word app object because I will use it later.

The Word doc is actually built using a macro in an Excel file.  I
thought about just reading the Excel file on open and skipping the
Word doc, but I don't know if it would save any time when I open the
VB app (the Excel file and Word list doc are maintained during times
the VB app is not in use).  I would save myself the extra step of
building the Word list file, but since it's a macro there's not real
time lost.

Another possibility would be to write the attributes to each Word doc
as CustomVariables, and iterate through the files reading these
variables into the arrays.

It doesn't take forever to open the app now, but there is a noticable
pause between launch and form open.  If using the Excel file or Custom
Variables would reduce the pause, I'd like that.

Ed

I agree with the others in saying that you should utilize a .csv file.
I do no agree however on parsing the file as text. I think you can use
a .csv file in conjunction with an ADO record set. You would have to
implement active x data objects to do this but it would be better in
the long run. The you can use the resultant data set that is opened
and just data bind the combo boxes. You may have to make some sub data
sets out of the original big one that results in the opening of
the .csv file but that shouldn't be to hard. see this link:

http://www.exceltip.com/st/Import_data_from_a_text_file_(ADO)_using_V...

it has the macro for excel to open the record set but the code should
mostly translate into VB6.

This would be the fastest method even if you had to break the record
set up into smaller ones because the ADO object dose all the parsing
and populating for you. You would never have to open a third party
app. I love data objects and I think this is a good scenario for their
strengths.

If the OP were use ADO, he would be better off to treat the original Excel
as a store, and skip the intermediate 'text' file. The only real reason to
keep the intermediate is because the 'business logic' is already written.

-ralph- Hide quoted text -

- Show quoted text -

.



Relevant Pages

  • Re: Fastest way to read data to populate combo controls?
    ... info into six arrays, and then uses these arrays to populate six ... and the VB app opens that document. ... but keep the Word app object because I will use it later. ... The Word doc is actually built using a macro in an Excel file. ...
    (microsoft.public.vb.general.discussion)
  • Re: Fastest way to read data to populate combo controls?
    ... info into six arrays, and then uses these arrays to populate six ... and the VB app opens that document. ... but keep the Word app object because I will use it later. ... The Word doc is actually built using a macro in an Excel file. ...
    (microsoft.public.vb.general.discussion)
  • Fastest way to read data to populate combo controls?
    ... When my VB6 app opens, the Form.Load code opens a document, reads the ... info into six arrays, and then uses these arrays to populate six ... The Word doc is actually built using a macro in an Excel file. ...
    (microsoft.public.vb.general.discussion)
  • Re: Fastest way to read data to populate combo controls?
    ... Excel file and maintain it at my leisure. ... doc with tables) for the VB app to read when I run the app. ... the type array the read all in one get. ... and the VB app opens that document. ...
    (microsoft.public.vb.general.discussion)
  • Re: Snow Leopard - Lost File Extensions & Custom Icons
    ... this document with the app that created it' behaviour set differently ... open-with code, ... about double-clicking this file opens it in TextWrangler; ... machine that's based on the creator code, on mine it's the default app ...
    (uk.comp.sys.mac)