Mauro Newbie

Joined: 13 Sep 2004 Posts: 3
|
Posted: Mon Sep 13, 2004 8:20 am Post subject: How close a spreadsheet and Oo in MS Visual Basic |
|
|
Hi,
I'm beginner in Oo and i'm learning about control in VB of Oo instead of MS Office.
Is very difficult, for me, understand Developper's Guide. But reading your topics I reached following level:
I made a project that read a spreadsheet, get cells A1,A2,B1 and write into B2, close the spreadshit without saving and close Oo.
| Code: |
Private Sub Command1_Click()
Dim args()
Set oServiceManager = CreateObject("com.sun.star.ServiceManager")
'Create the Desktop
Set oDesktop = oServiceManager.createInstance("com.sun.star.frame.Desktop")
'open an Oo each time I push command1, why?
' D'sG say open an Oo if not already open
'Open a calc document
Set oDoc = oDesktop.loadComponentFromURL("file:///c:/prova.sxc", "_blank", 0, args)
Set oSheet = oDoc.getSheets().getByIndex(0)
Set oCell = oSheet.getCellByPosition(0, 0)
Debug.Print oCell.Value
Set oCell = oSheet.getCellByPosition(0, 1)
Debug.Print oCell.Value
Set oCell = oSheet.getCellByPosition(1, 0)
Debug.Print oCell.Value
Set oCell = oSheet.getCellByPosition(1, 1)
oCell.setvalue (44)
'it works until here
'save (not necessary, only for knowledge)
'aa = oDesktop.storeAsURL("file:///c:/prova2.sxc", args) 'doesn't work
'oDesktop.Close() 'doesn't work
End Sub
|
Can somebody help me? Thanks  _________________ Mauro
(This World is too wide for me) |
|