VB6:Wanting to speed up populating six arrays on Form.Load

EdNerd

Active Member
Joined
May 19, 2011
Messages
464
I have a VB6 (Classic VB, not .NET) project. On Form.Load, I need to populate six arrays to feed into about a dozen Combo boxes.

Currently, I have my main list in an Excel sheet. An Excel macro looks at all my info and generates a Word document with six tables. (Word and Excel are 2000.) When my VB form loads, it opens the Word doc and iterates the tables, putting Table1 into Array1, etc. This is slow going!

I used the Word doc with Tables because it was easy to get six different tables of data into one file, and yet separate the info into arrays. The only other way I could think was to have the Excel macro write six different text files, then open those one by one and read into the arrays at Form.Load.

Is there a better, faster, easier way to set up the data from Excel to be read into the arrays?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Is there a reason you cannot simply load the data from the ranges in Excel into the arrays either by automating Excel or querying it using ADO?
 
Upvote 0
I keep the list in Excel because it's easier than trying to keep the list in a Word table. I've got five columns: ID (either "F" or "S"), Title, hyperlink, First, Second. When I write the six tables, they are separated out as hyperlink text and either Title, First, or Second, with one set of three for ID="F" and another three for ID="S" - six tables total. Plus I can sort the Excel sheet to alphabetical order before writing out the tables.

Editing the spreadsheet is not done while the VB program is opened. The VB program is not used in conjunction with the Excel file. I'm not calling the VB form from the Excel file. Since I have to open some kind of data file when I launch the VB program to populate the arrays, it just seemed easier to load up the arrays with a simple "For x = 1 To 6, Load array(1) with the contents of Table(1)" from Word than to iterate down Excel columns. Everything is text-only in the Word doc; in Excel, I'd need to grab just the link text and then either Col 2, 4, or 5, making sure I use the ID in Col 1 to decide which array set.
 
Upvote 0

Forum statistics

Threads
1,225,626
Messages
6,186,090
Members
453,337
Latest member
fiaz ahmad

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top