salvatore imparato
asked on
error runtime 429
...if i use the same code on a PC without Open Office the macro go in error in:
Set oSM = CreateObject("com.sun.star .ServiceMa nager")... .
To run this code in a pc whitout Open Office is possible? tks.
Private Sub Command1_Click()
'
'http://www.oooforum.org/forum/viewtopic.phtml?p=85097
'
'didier.alain@kalitech.fr
'
'
Dim oSM, oDesk, oDoc As Object 'OOo objects
Dim OpenParam(1) As Object 'Parameters to open the doc
Dim SaveParam(1) As Object 'Parameters to save the doc
Set oSM = CreateObject("com.sun.star .ServiceMa nager")
Set oDesk = oSM.createInstance("com.su n.star.fra me.Desktop ")
Set OpenParam(0) = MakePropertyValue("Hidden" , True) ' Open the file hidden
Set oDoc = oDesk.loadComponentFromURL ("file:/// C:/Documen ts and Settings/michel/dossier/ge neral/exce l/test.doc ", "_blank", 0, OpenParam())
Set SaveParam(0) = MakePropertyValue("FilterN ame", "writer_pdf_Export")
Call oDoc.storeToURL("file:///C :/Document s and Settings/michel/dossier/ge neral/exce l/test.pdf ", SaveParam())
Set oDesk = Nothing
Set oSM = Nothing
Unload Me
End Sub
'Automation/UNO bridge can't convert VB struct to UNO struct !
'cf http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+4+5+3+Usage+of+Types
'
'Creates a sequence of com.sun.star.beans.Propert yValue s
'
'Original from DannyB
'
Public Function MakePropertyValue(cName, uValue) As Object
Dim oStruct, oServiceManager As Object
Set oServiceManager = CreateObject("com.sun.star .ServiceMa nager")
Set oStruct = oServiceManager.Bridge_Get Struct("co m.sun.star .beans.Pro pertyValue ")
oStruct.Name = cName
oStruct.Value = uValue
Set MakePropertyValue = oStruct
End Function
Set oSM = CreateObject("com.sun.star
To run this code in a pc whitout Open Office is possible? tks.
Private Sub Command1_Click()
'
'http://www.oooforum.org/forum/viewtopic.phtml?p=85097
'
'didier.alain@kalitech.fr
'
'
Dim oSM, oDesk, oDoc As Object 'OOo objects
Dim OpenParam(1) As Object 'Parameters to open the doc
Dim SaveParam(1) As Object 'Parameters to save the doc
Set oSM = CreateObject("com.sun.star
Set oDesk = oSM.createInstance("com.su
Set OpenParam(0) = MakePropertyValue("Hidden"
Set oDoc = oDesk.loadComponentFromURL
Set SaveParam(0) = MakePropertyValue("FilterN
Call oDoc.storeToURL("file:///C
Set oDesk = Nothing
Set oSM = Nothing
Unload Me
End Sub
'Automation/UNO bridge can't convert VB struct to UNO struct !
'cf http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+4+4+5+3+Usage+of+Types
'
'Creates a sequence of com.sun.star.beans.Propert
'
'Original from DannyB
'
Public Function MakePropertyValue(cName, uValue) As Object
Dim oStruct, oServiceManager As Object
Set oServiceManager = CreateObject("com.sun.star
Set oStruct = oServiceManager.Bridge_Get
oStruct.Name = cName
oStruct.Value = uValue
Set MakePropertyValue = oStruct
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.