1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Sub callOpenOffice( NomduFichier As String)
Dim objServiceManager As Variant
Dim objCoreReflection As Variant
Dim objDesktop As Variant
Dim objDocument As Variant
Dim objSheet As Variant
Dim Cell As Variant
'The service manager is always the starting point
'If there is no office running then an office is started up
Set objServiceManager= CreateObject("com.sun.star.ServiceManager")
' Create the Desktop
Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
'Open a new empty writer document
Dim args()
Set objDocument = objDesktop.loadComponentFromURL("private:factory/scalc", "_blank", 0, args)
Set objSheet = objDocument.Sheets.getByIndex(0)
Dim J As Integer
J = 0
Do While (J<10 )
Set Cell = objSheet.getCellByPosition(0, J)
Cell.String = "Cell " & Cstr(J)
Set Cell = objSheet.getCellByPosition(1, J)
Cell.Value = 110
J = J + 1
Loop
End Sub |
Partager