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

Calling OOo macro from Image-Pro Plus

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


Joined: 29 Mar 2011
Posts: 3

PostPosted: Tue Mar 29, 2011 11:30 am    Post subject: Calling OOo macro from Image-Pro Plus Reply with quote

I'm writing an macro for MediaCybernetics Image-Pro Plus (IPP) to report on images.
The data from IPP is collected and then copied to clipboard.
I've written the OOo macro to paste the data in the right areas on the report.

What I can't figure out is the code for VB (used in IPP) to Call the OOo macro.

Any ideas?
I've looked all over, but no luck so far.
Back to top
View user's profile Send private message
rrossouw
Newbie
Newbie


Joined: 29 Mar 2011
Posts: 3

PostPosted: Wed Mar 30, 2011 1:51 am    Post subject: Reply with quote

So far I can open the OOo template document from the IPP macro.

Now to figure out how to call a macro from Standard.
This would essentially be the same as calling a OOo macro from a Word or Excel Macro.

It doesn't seem like anyone's done this yet....
Back to top
View user's profile Send private message
rrossouw
Newbie
Newbie


Joined: 29 Mar 2011
Posts: 3

PostPosted: Thu Mar 31, 2011 11:48 am    Post subject: Reply with quote

Found some leads, but the code's still not working right.

Code:


Function MakePropertyValue(cName, uValue) As Object

  Dim oPropertyValue As Object
  Dim oSM As Object

  Set oSM = CreateObject("com.sun.star.ServiceManager")
  Set oPropertyValue = oSM.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
  oPropertyValue.Name = cName
  oPropertyValue.Value = uValue

  Set MakePropertyValue = oPropertyValue

End Function

Sub Report()

   Dim oSM                   'Root object for accessing OpenOffice from VB
   Dim oDesk, oDoc, MakePropertyValue As Object 'First objects from the API
   'Dim arg()                 'Ignore it for the moment !

'Instanciate OOo : this line is mandatory with VB for OOo API
     Set oSM = CreateObject("com.sun.star.ServiceManager")
'Create the first and most important service
     Set oDesk = oSM.createInstance("com.sun.star.frame.Desktop")

     'arg(0) = MakePropertyValue("Hidden", False) 'can't get this part to work yet, so I dropped the macro security to lowest. Still no joy.
    'arg(1) = MakePropertyValue("MacroExecutionMode", 4)

'Open an existing doc (pay attention to the syntax for first argument)
   Set oDoc = oDesk.loadComponentFromURL("file:///C:/IPWIN70/Documents and Settings/coronareport2.ott", "_blank", 0, arg)

   ret = IpAppSelectDoc(IpDocFind("image.TIF")) 'IPP specific commands
   ret = IpSnap() 'IPP specific commands
   ret = IpWsCopy() 'IPP specific commands

   Dim dispatcher, objServiceManager, Frame, objDocument, createUnoService As Object
    Set dispatcher = objServiceManager.createInstance("com.sun.star.frame.DispatchHelper") 'createUnoService("com.sun.star.frame.DispatchHelper") '
    Set Frame = objDocument.getCurrentController().getFrame()
    Call oDoc.dispatcher.executeDispatch(Frame, "macro:///Standard.Module1.report1", "", 0, arg())


IPP says this line is not an object reference:
Set dispatcher = objServiceManager.createInstance("com.sun.star.frame.DispatchHelper") 'createUnoService("com.sun.star.frame.DispatchHelper")

Any ideas?
What am I missing?
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