Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I instantiate my *own* classes in StarBasic/OpenOffice Basic?

Status
Not open for further replies.

xavxav

Programmer
Sep 22, 2002
1
GB
Is it possible to instantiate my own classes in StarBasic / OpenOffice Basic (not just the OpenOffice API ones)?
How?
And what is the syntax for the constructor in the class?

I have written a working OpenOffice Basic Word .doc HTML converter to convert my uncle's academic research on Byron. Custom code is needed to convert his (many) texts efficiently to the form he wants them in for the Web.
Now I need to use classes to enhance it.
(The code is based on a working VBA converter which uses classes, but can't be further extended due to particular Word VBA bugs admitted by Microsoft.)

I can't get this test class to work:

In document testclass.sxw, in Standard library:
In Module myclass:
Dim mCount as Integer

Sub Inc
mCount = mCount + 1
End Sub

Sub Out
MsgBox "Count is " + Format(mCount)
End Sub

In Module myapp:
Sub Main
Dim test As New myclass REM FAILS WITH ERROR
test.Inc
test.Out
End Sub

The error is 'Object not accessible. Invalid object reference.'
Have tried:
Dim test As New [testclass.sxw].Standard.myclass
Dim test As New Standard.myclass
etc. etc.
... and other things
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top