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

Get a range using vb with calc document

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


Joined: 30 Dec 2003
Posts: 12

PostPosted: Tue Dec 30, 2003 9:21 am    Post subject: Get a range using vb with calc document Reply with quote

Hello everyone,

I'm new to staroffice. From visual basic(vb) I want to open a calc document , set a range for it and copy the values and do some manipulation.

this is the code i've been working on.


Sub test()

'Convertto URL
Set objServiceManager = CreateObject("com.sun.star.ServiceManager")
'Create the Desktop
Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")

Set mFileProperties(2) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
mFileProperties(2).Name = "Hidden"
mFileProperties(2).Value = "True"


Set mFileProperties(0) = objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
mFileProperties(0).Name = "FilterName"
mFileProperties(0).Value = "scalc: Text - txt - csv (StarCalc)"


'Open a new empty calc document

Set objDocument = objDesktop.loadComponentFromURL(FileName, "_blank", 0, mFileProperties())

Set oSheet = objDocument.getSheets().getByIndex(0)
'till here the code works fine
'#########################

Dim oRange As Object


oRange = oSheet.getCellRangeByPosition(0, 0, 10, 24)
' i'm getting error in the above statement. basically it is not accepting the range
the range object is not getting assigned


'#########################

End Sub

any idea whats wrong with this statement.

thanks & regards

Sabi
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Tue Dec 30, 2003 11:30 am    Post subject: Reply with quote

I think that getcellRangeByPosition does't exist.
Try
Code:

 oRange = oSheet.getCellRangeByName("A1:K24")

instead
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Author Message
Guest





PostPosted: Wed Dec 31, 2003 3:51 am    Post subject: Reply with quote

hi thanks for the reply. I tried getCellRangeByName("A1:K24") but still not working. As u said i guess this method doesn't exist. but still looking to get a proper reference to work with range object in visual basic.

Any help for this will be greatly appreciated
Back to top
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Wed Dec 31, 2003 9:11 am    Post subject: Reply with quote

Sorry but I never use VB to program OpenOffice, only OOOBasic
A stupid question, I suppose you write
Code:

 oRange = oSheet.getCellRangeByName("A1:K24")

why you don't write the "set" ?
Code:

 set oRange = oSheet.getCellRangeByName("A1:K24")

If you have tried it, I have no more idea.
I use OOO under windows but only at work and i will return at work only on monday. I will try VB.
To day, I am at home under Linux.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
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