OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to use .uno:PlayMacro with Dispatcher in VB

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Grooveman
General User
General User


Joined: 17 Feb 2004
Posts: 14

PostPosted: Wed Feb 18, 2004 11:41 pm    Post subject: How to use .uno:PlayMacro with Dispatcher in VB Reply with quote

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 Confused .

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
View user's profile Send private message
Grooveman
General User
General User


Joined: 17 Feb 2004
Posts: 14

PostPosted: Wed Feb 18, 2004 11:57 pm    Post subject: Reply with quote

I already found the answer to my problem Embarassed . 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
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 4021
Location: Lawrence, Kansas, USA

PostPosted: Thu Feb 19, 2004 7:06 am    Post subject: Reply with quote

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. Smile 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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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