View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Baranas[_2_] Dave Baranas[_2_] is offline
external usenet poster
 
Posts: 6
Default Listbox ColumnHeads

Hi Tom,

Hi Tom

I am now over in Autocad trying to hook back up with Excel. If Autocad
supports VBA just like Microsoft Excel supports it and both objects
expose the Rowsource property, then I think I am now driving a 1973
Ford Torino that has the Rowsourse light on the dashboard but does not
come on until you buy the LTD version. In other words There are a lot
of idiot lights in VBA that do not really work the way they are
supposed to.

Regards Dave



On Sun, 7 Dec 2003 19:45:30 -0500, "Tom Ogilvy"
wrote:

I ran this from Excel with a userform named Mn

Sub SetList()

Dim ObjXL As Object
Dim ObjActiveWkb As Object
Dim lstRange As Excel.Range
Dim lstValue As Variant
Set ObjXL = GetObject(, "Excel.Application")
Set ObjActiveWkb = ObjXL.Application.ActiveWorkbook

'Set Main List
With ObjActiveWkb
'Form Initialize will pass through here
Set lstRange = .Worksheets("CalcWin").Range("A2:AI101")

LstVal = lstRange.Value ' not needed
Mn.lstMain.ColumnCount = lstRange.Columns.Count
Mn.lstMain.RowSource = lstRange.Address(External:=True)
Mn.lstMain.ColumnHeads = True
End With
Mn.Show
Set ObjActiveWkb = Nothing: Set ObjXL = Nothing
End Sub


worked fine for me. However, you talk about being outside Excel without
being specific. According to this article:

http://support.microsoft.com/default...43&Product=wrd

Word, Powerpoint, and Outlook do not have a rowsource property for the
listbox and don't support columnheads. I suspect you will have to go back
to using the array approach and do without the column heads.