Hi all:
This may be a silly question, but I could not find the answer, so please forgive me. I am using OOo 3.0 on windows XP SP3.
I want to write a macro to insert a new OLE object into a Writer document and start the server. More specifically, I want to insert a new MathType equation, thus openieng the OLE server. How to do that? I tried to record a macro but it only opens the dialog.
Thank you in advance.
Fer
[Solved] Macro to insert an OLE object
[Solved] Macro to insert an OLE object
Last edited by fmolina on Tue Jan 20, 2009 9:05 pm, edited 1 time in total.
OOo 3.0.X on Ms Windows XP + fedora linux/solaris (to be)
Re: Macro to insert an OLE object
Search the ol' forum's "Code Snippets" forum for "OLE". http://www.oooforum.org/forum/search.phtml
One of the results: http://www.oooforum.org/forum/viewtopic ... hlight=ole
One of the results: http://www.oooforum.org/forum/viewtopic ... hlight=ole
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Macro to insert an OLE object
Thanks Villeroy, I found code but , seems to not be working in 3.0.
Specifically, I found this: http://www.oooforum.org/forum/viewtopic ... hlight=ole
(first example) but it does not work well: It opens OOo Math but then starts an endless chain of beeps and does not respond anymore. I must kill OOo Writer to stop.
¿Someone has any further advice?
Regards
Specifically, I found this: http://www.oooforum.org/forum/viewtopic ... hlight=ole
(first example) but it does not work well: It opens OOo Math but then starts an endless chain of beeps and does not respond anymore. I must kill OOo Writer to stop.
¿Someone has any further advice?
Regards
OOo 3.0.X on Ms Windows XP + fedora linux/solaris (to be)
Re: Macro to insert an OLE object
Ooops - I will check that in two weeks when I am back at my computer. I am still at OO 2.4fmolina wrote:...Specifically, I found this: http://www.oooforum.org/forum/viewtopic ... hlight=ole
(first example) but it does not work well: It opens OOo Math but then starts an endless chain of beeps and does not respond anymore. I must kill OOo Writer to stop....
To insert OO objects into writer, I would recommend an easier way:
1.) create an ole2shape by the document's createInstance method
2.) insert it into drawpage
3.) set the CLSID to the math formula CLSID. You can get that by xraying a doc with an formula inserted
see http://www.oooforum.org/forum/viewtopic.phtml?t=61104 as a java example
For then activating / modifying the inserted formula see http://www.oooforum.org/forum/viewtopic.phtml?t=78793
Good luck,
ms777
Re: Macro to insert an OLE object
Thanks, ms777, I will chek that and tell what happened
Regards
Regards
OOo 3.0.X on Ms Windows XP + fedora linux/solaris (to be)
Re: Macro to insert an OLE object
OK, it worked, borrowing some code from Andrew Pitonyak's macro guide. The code to insert a MathType 6 equation is
By the way, I tried a bit to do the same with OOo Math but without success. Not a big deal, because there is a button to do that.
Regards,
Fernando
Code: Select all
sub InsertMathTypeEcuation
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().Selection.getByIndex(0))
oXEO = obj.ExtendedControlOverEmbeddedObject
oXEO.doVerb(0)
end sub
Regards,
Fernando
OOo 3.0.X on Ms Windows XP + fedora linux/solaris (to be)
-
- Posts: 5
- Joined: Tue Mar 21, 2017 7:46 am
Re: [Solved] Macro to insert an OLE object
Given links are not working. I want to insert a ole object from a specified path by using macro. I tried to record a macro to reach dispatchers but it didn't help me. Also I couldn't find any solution to my problem. Is there any way to do it? Thanks.
OpenOffice 4.1.3 on Windows 10