a excel file into a visual basic listbox 
Author Message
 a excel file into a visual basic listbox

I like to add a column from a excel file into a Visual Basic listbox.
is this possible?... how?...

   Ray!



Wed, 18 Jun 1902 08:00:00 GMT  
 a excel file into a visual basic listbox
Hey
Something like this, but keep in mind that this is very slow (I'm searching
for a better way too)

Hope you can start with this

Dim xlApp As Excel.Application
Dim xlWkBk As Excel.Workbook
Dim xlWkSht As Excel.Worksheet

 Set xlApp = CreateObject("Excel.Application")
 Set xlWkBk = xlApp.Workbooks.Open("c:\order.xls")
 Set xlWkSht = xlWkBk.Sheets(1) 'can also use .Sheets("<name of worksheet>")

Dim Buffer as Range

Set Buffer = xlWkSht.Cells(NumberA, NumberB)
 List1.additem(Buffer)



Quote:
> I like to add a column from a excel file into a visual basic listbox.
> is this possible?... how?...

>    Ray!



Wed, 18 Jun 1902 08:00:00 GMT  
 a excel file into a visual basic listbox
Its pretty tough! Drag and drop it.
BG
Quote:

> I like to add a column from a excel file into a visual basic listbox.
> is this possible?... how?...

>    Ray!



Wed, 18 Jun 1902 08:00:00 GMT  
 a excel file into a visual basic listbox
No, you just have to use this loop:

Range("a1").select
do until activecell = empty
    listbox1.additem activecell.value
    activecell.offset(1, 0).select
Loop

That will feed every value from column A into your listbox, as long as there
are no spaces.

Tom Moralis


Quote:
> Its pretty tough! Drag and drop it.
> BG


> > I like to add a column from a excel file into a visual basic listbox.
> > is this possible?... how?...

> >    Ray!



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. excel runtime 1004 - visual basic file not found

2. Excel input file, new to Visual Basic

3. Viewing Excel Files within Visual Basic 6

4. Excel / excel macros created within Visual Basic

5. Use of Excel functions in visual basic functions in excel module

6. looking for conversion software for MS Excel 4.0 (ELM) to MS Excel 5.0 visual Basic

7. In Visual Basic 5.0, populating a listbox?

8. Visual Basic Listbox control

9. Visual Basic Listbox control

10. Getting a handle for a Visual Basic Listbox

11. Quick Basic files in Visual Basic?

12. ListBox in Word from Excel external file

 

 
Powered by phpBB® Forum Software