1 Replies - 2697 Views - Last Post: 17 July 2012 - 03:19 PM Rate Topic: -----

#1 katie1988   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 17-July 12

Display data from listview in OpenOffice VB6

Posted 17 July 2012 - 04:08 AM

I have a program that displays data from a CSV file into a ListView.
I then have a button called "Reports" - when I click this I want the data to be displayed from the ListView/CSV file in OpenOffice Calc.

This is my code:

Private Sub cmdReports_Click()
Dim oSM As Object 
Dim oDesk As Object 
Dim oDoc As Object
Dim oSheet As Object
Dim i As Integer

'Instanciate OOo : this line is mandatory with VB for OOo API
Set oSM = CreateObject("com.sun.star.ServiceManage…
'Create the first and most important service
Set oDesk = oSM.CreateInstance("com.sun.star.frame.D…
'Create a new doc
Set oDoc = oDesk.loadComponentFromURL("private:fact… "_blank", _
0, arg())
'Get the first sheet in the doc
Set oSheet = oDoc.getSheets().getByIndex(0)

With oSheet
For i = 1 To ListView1.ListItems.Count
.cells(i, 1) = ListView1.ListItems(i).Text
.cells(i, 2) = ListView1.ListItems(i).SubItems(1)
.cells(i, 3) = ListView1.ListItems(i).SubItems(2)
.cells(i, 4) = ListView1.ListItems(i).SubItems(3)
End With
End Sub

At the moment all my button is doing giving me Run-time error '438' Object does not support this property or method
When I debug this line is highlighted

.cells(i, 1) = ListView1.ListItems(i).Text

This code was written for Excel but I edited it so it can be displayed in OpenOffice Calc.
Can anyone help please?

Is This A Good Question/Topic? 0
  • +

Replies To: Display data from listview in OpenOffice VB6

#2 BobRodes   User is offline

  • Lovable Curmudgeon
  • member icon

Reputation: 600
  • View blog
  • Posts: 3,071
  • Joined: 19-May 09

Re: Display data from listview in OpenOffice VB6

Posted 17 July 2012 - 03:19 PM

What it's saying is that there is no Cells property in whatever object GetSheets is getting.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1