| View previous topic :: View next topic |
| Author |
Message |
wolfgang Guest
|
Posted: Tue Feb 24, 2004 9:38 am Post subject: Accessing Windows registry / invoking macro |
|
|
Hi!
I would like to access a certain entry in the windows registry out of an OpenOffice Basic macro.
Does anyone know how to do this??
And a second question:
I found out how to activate an instance of openOffice and open a certain OpenOffice Calc file out of my VisualBasic application. I know would like to invoke a macro in the Calc-file out of the VisualBasic application!
-Has anyone come across this requirement before and knows a solution??
Any help would be highly appreciated!
Thanks in advance!
wolfgang |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 4021 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
Henrik OOo Enthusiast

Joined: 15 Jan 2004 Posts: 118
|
Posted: Tue Feb 24, 2004 2:36 pm Post subject: |
|
|
Hi,
| Quote: |
DannyB wrote:
It is possible to write code in VB, save it as a DLL, register it, and then call it from OOo Basic.
This technique would allow you to do anything Windows specific, such as access the registry.
|
Just thought I should mention that this is also very possible to do in Python. I know DannyB knows that of course, but after using Python for a while now I like it so much that advocating a bit for the language seemed like the right thing to do
Maybe you already know python, if not here a a couple of links:
www.python.org
http://starship.python.net/crew/mhammond/ # windows extension you'll need to code against the registry.
Henrik |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Feb 25, 2004 8:16 am Post subject: |
|
|
Hello!
Thank you very much for for the links to these topics of interest.
Unfortunately I still have some problems, invoking a macro stored in a certain workbook.
Out of my Visual Basic 6 application I open the OpenOffice calc document by:
Set objDocument = objDesktop.loadComponentFromURL("file:///c:/Test/DemoCode.sxc", "_blank", 0, args)
Set Frame = objDocument.getCurrentController().getFrame()
Then I want to call a macro in this document (DemoCode.sxc) and pass a parameter. According to the posts I read on this topic this should work somehow like:
Call dispatcher.executeDispatch(Frame, "macro://DemoCode/Standard.Module1.Hello(myText)", "", 0, args)
Unfortunately the macro is not executed.
Calling the macro works, if I place the macro not in the opened document, but in the "root" for macros (soffice) and then call it like:
Call dispatcher.executeDispatch(Frame, "macro:///Standard.Module1.Hello(MyText)", "", 0, args)
Has anyone an idea what I am doing wrong?
Thanks in advance,
wolfgang |
|
| Back to top |
|
 |
wolfo Newbie

Joined: 26 Feb 2004 Posts: 3
|
Posted: Wed Mar 03, 2004 2:57 am Post subject: |
|
|
| Quote: |
Out of my Visual Basic 6 application I open the OpenOffice calc document by:
Set objDocument = objDesktop.loadComponentFromURL("file:///c:/Test/DemoCode.sxc", "_blank", 0, args)
|
Macros have to be enabled in the opened document. You have to set the MacroExectutionMode by passing the appropriate parameter:
| Code: |
Dim args(0) As Object
Set args(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
args(0).Name = "MacroExecutionMode"
args(0).Value = 4
Set objDocument = objDesktop.loadComponentFromURL("file:///c:/Test/DemoCode.sxc", "_blank", 0, args())
|
DannyB has posted a link to the description of MacroExecutionMode contants:
http://www.oooforum.org/forum/viewtopic.php?p=16178#16178
I didn't find out how to access the constants in Visual Basic so I used the absolute value.
Opening the document like that makes it possible to call macros in the document out of VB. |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 4021 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|