| View previous topic :: View next topic |
| Author |
Message |
Grooveman General User

Joined: 17 Feb 2004 Posts: 14
|
Posted: Wed Feb 18, 2004 11:41 pm Post subject: How to use .uno:PlayMacro with Dispatcher in VB |
|
|
Hi,
I'm using Visual Basic 6 and I'm making a program to open OOo and to use print and save functions. I have chosen to open the OOo with VB and for the printing functions I use selfmade macro's.
Now I'm trying to use the PlayMacro to call the macro with the dispatcher. But I seem to do something wrong. Do I have to give the property an other name?Can somebody correct my failure .
| Code: |
Dim x(0)
Set x(0) = createStruct("com.sun.star.beans.PropertyValue")
x(0).Name = "Name"
x(0).Value = "CSP.PrintandSave.PrintCurrentDocument"
Call dispatcher.executeDispatch(Frame, ".uno:PlayMacro", "", 0, x)
|
|
|
| Back to top |
|
 |
Grooveman General User

Joined: 17 Feb 2004 Posts: 14
|
Posted: Wed Feb 18, 2004 11:57 pm Post subject: |
|
|
I already found the answer to my problem . It works without the uno:PlayMacro. But if somebody knows how to use the PlayMacro, I'm interested in the way to make it work.
| Code: |
Dim dispatcher As Object
Set dispatcher = objServiceManager.createInstance"com.sun.star.frame.DispatchHelper")
Set Frame = objDocument.getCurrentController().getFrame()
Call dispatcher.executeDispatch(Frame, "macro:///CSP.PrintandSave.PrintCurrentDocument", "", 0, args)
|
|
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 4021 Location: Lawrence, Kansas, USA
|
Posted: Thu Feb 19, 2004 7:06 am Post subject: |
|
|
That is a very interesting bit of information. You can execute a macro by passing a macro url to the dispatcher. I'll have to remember that. I suspect it would work by passing the Desktop object as the frame parameter. (The Desktop is a frame, btw.)
I'm still planning to answer your question about getting the active printer name. Essentially about working with property lists in VB. This will require me to spend some quality time with VB, which is the reason for the delay. _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
|