Page 1 of 1

MathType Macro for OO

Posted: Mon Aug 20, 2012 12:53 am
by thedoctor818
Hullo all. I am currently running Lubuntu 12.04, and using (though I had rather be using LaTeX-I have no choice in the matter-my new job requires MathType)MathType 6.8 I think. I was told that by inserting the following macro:

Code: Select all

sub InsertMathTypeObject
rem ----------------------------------------------------------------------
rem define variables
dim obj as object
dim SName as string
dim oXEO as object
rem ----------------------------------------------------------------------
SName = "com.sun.star.text.TextEmbeddedObject"
obj = ThisComponent.createInstance(sName)
obj.CLSID = "0002CE03-0000-0000-C000-000000000046"
obj.attach(ThisComponent.currentController().Selec tion.getByIndex(0))
oXEO = obj.ExtendedControlOverEmbeddedObject
oXEO.doVerb(0)

end sub
I could then insert MT objects into OO. But so far, not only can I not go to Insert->Object->New->MT Object; but every time I try (copy and paste and manually typing it) to add the above macro, I get the following error:

BASIC runtime error.Object variable not set.

at the last line (oXEO.doVerb(0))

Pleas help. The only reason I 'ditched' LO and went 'back' to OO is that my local manager gave me the above code and said it was specifially for OO. If there is a similar macro for Lo, and I knew it would work, I would go back to that - but I am kind of stuck now, so any help is appreciated. Thanks.

Re: MathType Macro for OO

Posted: Mon Aug 20, 2012 2:33 am
by FJCC
I know nothing about MathType. I reproduced the error when running your code. Finding nothing wrong with it, as far as I could tell, I did a web search for CLSID MathType and found this. By changing the CLSID to the one found there, the code runs without error, brings up the Microsoft Equation Editor and whatever I type in that get embedded in my Writer document. Is that any help?

Code: Select all

SName = "com.sun.star.text.TextEmbeddedObject"
obj = ThisComponent.createInstance(sName)
obj.CLSID = "00021700-0000-0000-C000-000000000046" 'Changed by FJCC
obj.attach(ThisComponent.currentController().Selection.getByIndex(0))
oXEO = obj.ExtendedControlOverEmbeddedObject
oXEO.doVerb(0)

Re: MathType Macro for OO

Posted: Mon Aug 20, 2012 3:02 am
by thedoctor818
No unfortunately when I change the code I still get the mentioned error and the 'red arrow' (which I am guessing points to the incorrect lines of code?) is pointing to the last line, namely:

oXEO.doVerb(0)

Thanks again.

Re: MathType Macro for OO

Posted: Mon Aug 20, 2012 4:39 am
by FJCC
What I saw is that without a valid CLSID the obj has a VOID ExtendedControlEmbeddedObject. That results in oXEO not containing anything and when you try to use its doVerb() method, you get an error. The problem, however, is really at the assignment of the CLSID. Unfortunately, I don't know how to address that other than what I posted before.

Re: MathType Macro for OO

Posted: Wed Aug 22, 2012 10:55 am
by hanya
Wonder MathType works on Lubuntu?

Re: MathType Macro for OO

Posted: Wed Aug 22, 2012 12:58 pm
by thedoctor818
Yes, MathType works on Lubuntu via Wine-or are you asking if this macro will work in Lubuntu? I do not know, but i hope so. However until I can get this CLSID issue fixed (and I have searched the net quite a bit) I dunno what to do. This is kind of becoming urgent for me (and my job) that I resolve this soon. Thanks.

Re: MathType Macro for OO

Posted: Sat Aug 25, 2012 6:52 pm
by thedoctor818
I am close to a solution here if I can just get some help. I ended up installing both MT and OO under WINE. Now the macros above works, but when I get back to OO, the equation I edited (or entered) in MT just appears as a blank box. What can I do next to solve this issue? Thanks.