Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, I am trying to learn how to work with the list of
informtion in a listbox. I have added the list using AddItem. Now I want to print that list to file. The following code does not work, and has my notes. I would appreciate any suggestions on how to make the print statement work, but also how to move data into this two- column listbox list. Thank you Keith var3 = ListBox1.ListCount Close #1 i = 0 Open "c:\test\temp.txt" For Output As #1 For i = 0 To var3 - 1 'Each In ListBox1 'i = i + 1 Print #1, i 'Print #1, ListBox1(i).Value ' not accepted at run time 'Print #1, ListBox1(i, 1).Value ' not accepted at run time 'Print #1, ListBox1(i, 0).Value ' not accepted 'Print #1, ListBox1(i).Text Next i Close #1 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
NOT
ListBox1(i).Value With Listbox1 For i = 0 to .ListCount -1 Print #1, .List(i) Next Close End With '' note the "." before ListCount and also List "Keith" wrote: Hello, I am trying to learn how to work with the list of informtion in a listbox. I have added the list using AddItem. Now I want to print that list to file. The following code does not work, and has my notes. I would appreciate any suggestions on how to make the print statement work, but also how to move data into this two- column listbox list. Thank you Keith var3 = ListBox1.ListCount Close #1 i = 0 Open "c:\test\temp.txt" For Output As #1 For i = 0 To var3 - 1 'Each In ListBox1 'i = i + 1 Print #1, i 'Print #1, ListBox1(i).Value ' not accepted at run time 'Print #1, ListBox1(i, 1).Value ' not accepted at run time 'Print #1, ListBox1(i, 0).Value ' not accepted 'Print #1, ListBox1(i).Text Next i Close #1 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You need to use the .Column property, e.g:
Print #1, ListBox1.Column(0,i) ' Prints row i-1, column 1 Note that the column and row values are 0 based; the first one is numbered 0 "Keith" wrote: Hello, I am trying to learn how to work with the list of informtion in a listbox. I have added the list using AddItem. Now I want to print that list to file. The following code does not work, and has my notes. I would appreciate any suggestions on how to make the print statement work, but also how to move data into this two- column listbox list. Thank you Keith var3 = ListBox1.ListCount Close #1 i = 0 Open "c:\test\temp.txt" For Output As #1 For i = 0 To var3 - 1 'Each In ListBox1 'i = i + 1 Print #1, i 'Print #1, ListBox1(i).Value ' not accepted at run time 'Print #1, ListBox1(i, 1).Value ' not accepted at run time 'Print #1, ListBox1(i, 0).Value ' not accepted 'Print #1, ListBox1(i).Text Next i Close #1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Strange Excel problem with Jump List | New Users to Excel | |||
Excel list problem | Excel Discussion (Misc queries) | |||
Excel 2003 - XML List Formatting Problem | Excel Discussion (Misc queries) | |||
Excel List Sorting Problem (Descending) | Excel Discussion (Misc queries) | |||
Excel Validation / Dropdown list Problem | Excel Programming |