rrossouw Newbie

Joined: 29 Mar 2011 Posts: 3
|
Posted: Thu Mar 31, 2011 11:48 am Post subject: |
|
|
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? |
|