ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListView Control (https://www.excelbanter.com/excel-programming/412724-listview-control.html)

RLang

ListView Control
 
Hi,
I'm having a bit of trouble getting started populating a ListView control
placed on an Excel worksheet. I'm using the Microsoft ListView Control,
Version 6.0. I have Excel 2003 SP2. I've already used the same control in a
form in VB 6 with no problem. My code for setting up multiple column
headers, enabling gridlines, and adding rows of data isn't quite taking. The
same code in VB 6 is not working in VBA and I'm just looking for a little
starter help to get me going.

Harald Staff[_2_]

ListView Control
 
Seeing some code would help to help. "Not working" is meaningless -unless
someone big wants his money back..

Best wishes Harald


"RLang" wrote in message
...
Hi,
I'm having a bit of trouble getting started populating a ListView
control
placed on an Excel worksheet. I'm using the Microsoft ListView Control,
Version 6.0. I have Excel 2003 SP2. I've already used the same control
in a
form in VB 6 with no problem. My code for setting up multiple column
headers, enabling gridlines, and adding rows of data isn't quite taking.
The
same code in VB 6 is not working in VBA and I'm just looking for a little
starter help to get me going.



RLang

ListView Control
 
Hi Harald, starting off simple, I'm expecting the code below to create three
columns with headers and one data line entry. This code is identical to what
I'm using in VB 6.0 to use the ListView control. The control is embedded on
the worksheet ("start") surface and is named ListView1. Right now only one
column appears with the "Rec" header title and then empty data records follow
with gridlines.

Sub CommandButton4_Click()

Dim itmX

Sheets("start").ListView1.ListItems.Clear
Sheets("Start").ListView1.ColumnHeaders.Add , , "Rec",
Sheets("Start").ListView1.Width * (3 / 5)
Sheets("Start").ListView1.ColumnHeaders.Add , , "Date/Time",
Sheets("Start").ListView1.Width * (1 / 5)
Sheets("Start").ListView1.ColumnHeaders.Add , , "Prod ID",
Sheets("Start").ListView1.Width * (1 / 5)

Set itmX = Sheets("start").ListView1.ListItems.Add()
itmX.Text = "1234"
itmX.SubItems(1) = "1/1/2008"
itmX.SubItems(2) = "890"

End Sub


"Harald Staff" wrote:

Seeing some code would help to help. "Not working" is meaningless -unless
someone big wants his money back..

Best wishes Harald


"RLang" wrote in message
...
Hi,
I'm having a bit of trouble getting started populating a ListView
control
placed on an Excel worksheet. I'm using the Microsoft ListView Control,
Version 6.0. I have Excel 2003 SP2. I've already used the same control
in a
form in VB 6 with no problem. My code for setting up multiple column
headers, enabling gridlines, and adding rows of data isn't quite taking.
The
same code in VB 6 is not working in VBA and I'm just looking for a little
starter help to get me going.




RLang

ListView Control
 
Nevermind, I think I've got her working now.

"RLang" wrote:

Hi Harald, starting off simple, I'm expecting the code below to create three
columns with headers and one data line entry. This code is identical to what
I'm using in VB 6.0 to use the ListView control. The control is embedded on
the worksheet ("start") surface and is named ListView1. Right now only one
column appears with the "Rec" header title and then empty data records follow
with gridlines.

Sub CommandButton4_Click()

Dim itmX

Sheets("start").ListView1.ListItems.Clear
Sheets("Start").ListView1.ColumnHeaders.Add , , "Rec",
Sheets("Start").ListView1.Width * (3 / 5)
Sheets("Start").ListView1.ColumnHeaders.Add , , "Date/Time",
Sheets("Start").ListView1.Width * (1 / 5)
Sheets("Start").ListView1.ColumnHeaders.Add , , "Prod ID",
Sheets("Start").ListView1.Width * (1 / 5)

Set itmX = Sheets("start").ListView1.ListItems.Add()
itmX.Text = "1234"
itmX.SubItems(1) = "1/1/2008"
itmX.SubItems(2) = "890"

End Sub


"Harald Staff" wrote:

Seeing some code would help to help. "Not working" is meaningless -unless
someone big wants his money back..

Best wishes Harald


"RLang" wrote in message
...
Hi,
I'm having a bit of trouble getting started populating a ListView
control
placed on an Excel worksheet. I'm using the Microsoft ListView Control,
Version 6.0. I have Excel 2003 SP2. I've already used the same control
in a
form in VB 6 with no problem. My code for setting up multiple column
headers, enabling gridlines, and adding rows of data isn't quite taking.
The
same code in VB 6 is not working in VBA and I'm just looking for a little
starter help to get me going.





All times are GMT +1. The time now is 02:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com