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



If I follow you..
Why not simply write the Excel data to a .csv or .tsv (tab) then read in to
VB app.
That would be the fastest since no objects would be involved.
If you write the Excel macro correctly you could read the data files in two
file gets it the data types support. i.e. get the number of types, resize
the type array the read all in one get. One pass for each set of data files.
What are the data types?

Or Using VBA in Excel? I think that it writes variants. And reading a
variant array into VB is also fast.

"Ed from AZ" 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

.



Relevant Pages

  • Re: unique, independent instance of Word
    ... The method they suggest is to use CreateObject twice to create two ... instances of Excel, then to discard the first and retain a reference to the ... second instance should remain private to your app. ... independently open a Word doc; this makes all docs used by that instance ...
    (microsoft.public.vb.general.discussion)
  • Re: Excel info copied into existing Word table
    ... In the Word doc select exactly the same array of cells as what has been ... copied from Excel, then just use the regular Paste ...
    (microsoft.public.word.docmanagement)
  • Help copying an array into an ADO recordset
    ... I have an array of data that has been crunched that I would like to copy into an ADO recordset. ... I'm presuming that this process is the same regardless of App (i.e. whether working in Excel or Access?). ...
    (microsoft.public.access.queries)
  • Re: close excel from VB6
    ... Indeed all well known in Excel land. ... In VBA to do otherwise would cause the app to blow (if the ... MSO app from a VB6.exe or are a MSO addin interfacing with VB6.DLLs. ... learning programming was a good idea because my years of business ...
    (microsoft.public.vb.general.discussion)
  • Re: I believe Ive found an Access bug...can anyone confirm?
    ... Set objXL = CreateObject ... and use the Excel function from Access. ... Dim IRRValues() As Variant ' Set up array. ...
    (microsoft.public.access.modulesdaovba)

Loading