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

How close a spreadsheet and Oo in MS Visual Basic

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


Joined: 13 Sep 2004
Posts: 3

PostPosted: Mon Sep 13, 2004 8:20 am    Post subject: How close a spreadsheet and Oo in MS Visual Basic Reply with quote

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 Shocked
_________________
Mauro
(This World is too wide for me)
Back to top
View user's profile Send private message
Mauro
Newbie
Newbie


Joined: 13 Sep 2004
Posts: 3

PostPosted: Mon Sep 13, 2004 8:28 am    Post subject: Reply with quote

I apologise,
I've seen DannyB (t=4996) after posted it
Sorry,
_________________
Mauro
(This World is too wide for me)
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