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

Simple Question

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
shawnm
General User
General User


Joined: 13 Oct 2005
Posts: 8

PostPosted: Thu Oct 13, 2005 4:59 am    Post subject: Simple Question Reply with quote

I am sorry to bug you guys, but I am a converted Excel user. I am trying to perform simple if then statements and having a hard time. I am using multiple spreadsheets. Here is what I have now:

oDoc = ThisCompnent()

oSheet = ThisCompnent.getSheets.getByName( "sheet_1" )
oSheet2 = ThisCompnent.getSheets.getByName( "sheet_2" )

IF (oSheet.B1 = "") then

and it breaks right there saying "property or method not found." I have read examples trying to figure this out and I can't. How do I call sheet_1 with the B1 cell?

THanks.
Back to top
View user's profile Send private message
davidh182
OOo Advocate
OOo Advocate


Joined: 01 Apr 2004
Posts: 413

PostPosted: Thu Oct 13, 2005 5:25 am    Post subject: Reply with quote

Code:

oSheet = ThisComponent.getSheets.getByName( "sheet1" )
oSheet2 = ThisComponent.getSheets.getByName( "sheet2" )
IF oSheet.getCellByPosition(1,0).String = "" then
msgbox("B1 is Empty")
else
msgbox("B1 is not Empty")
end if
Back to top
View user's profile Send private message Send e-mail
shawnm
General User
General User


Joined: 13 Oct 2005
Posts: 8

PostPosted: Thu Oct 13, 2005 6:38 am    Post subject: thats it... Reply with quote

Yip, that's it! Thank you so much. I greatly appreciate it!

Shawn
Back to top
View user's profile Send private message
Rich102
Newbie
Newbie


Joined: 25 Nov 2008
Posts: 4

PostPosted: Tue Nov 25, 2008 2:40 am    Post subject: Reply with quote

I put the code example above into a worksheet and it works fine. But for various reasons, I'd really rather use getCellByName. When I substitute that for getCellByPosition, I get "Property or method not found." I'm very new at this stuff, although with prior programming experience. (I've looked around the forum and done some searches, but this seems to be the most straightforward topic to start from.) Any help would be appreciated.

Dick (using OOo 3.0.0 under XP SP2)
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Tue Nov 25, 2008 6:48 am    Post subject: Reply with quote

It's getCellRangeByName("B1").
Back to top
View user's profile Send private message
Rich102
Newbie
Newbie


Joined: 25 Nov 2008
Posts: 4

PostPosted: Sat Dec 13, 2008 2:31 am    Post subject: Reply with quote

Ok, now I see. I'd missed that getCellByName was not available in Calc. Rereading some examples, I see now that it works with text documents, but not in Calc. Thanks for a quick response.
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 Calc 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