Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default How to populate a multi-column activeX listbox on a spreadsheet with an ADO recordset

Hello, I'm using VBA in Excel XP with Win 2000

Does anyone know how to populate a multi-column activeX listbox on a spreadsheet with an ADO recordset

I am returning the field count and setting the number of columns needed in the list box, but I can't figure out how to load the list box with the data

Can I use "CopyFromRecordSet" some how? Must I convert the RecordSet into an array? What

Please supply example code. Thanks much in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to populate a multi-column activeX listbox on a spreadsheet with an ADO recordset

If you use CopyFromRecordset to poulate a worksheet range, you could then
poiunt the Listbox at that

Worksheets("Sheet2").Range("A1").CopyFromRecordset rsData
With Me.ListBox1
.ColumnCount = 3
.RowSource = "Sheet2!A1:C4"
End With

or you could load the recordset to an array and use that directly

ary = RS.GetRows()
With Me.ListBox1
.ColumnCount = 3
.List = ary
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"quartz" wrote in message
...
Hello, I'm using VBA in Excel XP with Win 2000.

Does anyone know how to populate a multi-column activeX listbox on a

spreadsheet with an ADO recordset?

I am returning the field count and setting the number of columns needed in

the list box, but I can't figure out how to load the list box with the data.

Can I use "CopyFromRecordSet" some how? Must I convert the RecordSet into

an array? What?

Please supply example code. Thanks much in advance.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
populating a multi-column Listbox Tom Ogilvy Excel Programming 3 April 26th 04 08:26 PM
populating a multi-column Listbox Harald Staff Excel Programming 1 April 26th 04 08:26 PM
Missing: Microsoft ActiveX Data Objects Recordset 2.7 Library Debi[_2_] Excel Programming 2 March 4th 04 06:37 PM
Multi-column ListBox. Multiple bound columns??? Joe Mathis Excel Programming 5 December 10th 03 01:32 AM
Date formatting in a multi column listbox Nigel Brown[_2_] Excel Programming 2 September 3rd 03 11:29 AM


All times are GMT +1. The time now is 10:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"