且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Excel VBA中用SQL记录集填充多列列表框

更新时间:2023-12-01 10:39:52

您可以在Array中获取记录集,然后像这样填充ListBox.而且由于您是动态填充ListBox的,因此Headers在这里不起作用,但是您可以在ListBox上方添加带有标题的Labels.

You can get the recordset in an Array and then populate the ListBox like this. And since you are populating the ListBox dynamically, the Headers will not work here but you can add the Labels with headers just above the ListBox if that works for you.

Dim arr
arr = rs.GetRows
.List = arr