?
Solved

Populate a combobox list using excel 2000 data

Posted on 2004-09-01
2
Medium Priority
?
170 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 150 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

862 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