Solved

Populate a combobox list using excel 2000 data

Posted on 2004-09-01
2
144 Views
Last Modified: 2010-05-02
using an excel application object, how can you populate a combobox list using data that is specifically located in a maintained excel file?
0
Comment
Question by:japhet
2 Comments
 
LVL 2

Accepted Solution

by:
craigewens earned 50 total points
ID: 11950629
Private Sub Form_Load()

Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Visible = True
ExcelSheet.Sheets("Sheet1").Cells(1, 1).Value = "Column 1, Row 1"
ExcelSheet.Sheets("Sheet1").Cells(2, 1).Value = "Column 1, Row 2"
ExcelSheet.Sheets("Sheet1").Cells(3, 1).Value = "Column 1, Row 3"
ExcelSheet.Sheets("Sheet1").Cells(4, 1).Value = "Column 1, Row 4"
ExcelSheet.Sheets("Sheet1").Cells(5, 1).Value = "Column 1, Row 5"
ExcelSheet.Sheets("Sheet1").Cells(6, 1).Value = "Column 1, Row 6"

For i = 1 To 6
    Combo1.AddItem ExcelSheet.Sheets("Sheet1").Cells(i, 1)
    DoEvents
Next i
Combo1.ListIndex = 0
ExcelSheet.Application.Quit
Set ExcelSheet = Nothing

End Sub
0
 

Author Comment

by:japhet
ID: 11970706
Thanks craigewens, I got the gist... =)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question