| View previous topic :: View next topic |
| Author |
Message |
shawnm General User

Joined: 13 Oct 2005 Posts: 8
|
Posted: Thu Oct 13, 2005 4:59 am Post subject: Simple Question |
|
|
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 |
|
 |
davidh182 OOo Advocate

Joined: 01 Apr 2004 Posts: 413
|
Posted: Thu Oct 13, 2005 5:25 am Post subject: |
|
|
| 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 |
|
 |
shawnm General User

Joined: 13 Oct 2005 Posts: 8
|
Posted: Thu Oct 13, 2005 6:38 am Post subject: thats it... |
|
|
Yip, that's it! Thank you so much. I greatly appreciate it!
Shawn |
|
| Back to top |
|
 |
Rich102 Newbie

Joined: 25 Nov 2008 Posts: 4
|
Posted: Tue Nov 25, 2008 2:40 am Post subject: |
|
|
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 |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8979 Location: Lexinton, Kentucky, USA
|
Posted: Tue Nov 25, 2008 6:48 am Post subject: |
|
|
| It's getCellRangeByName("B1"). |
|
| Back to top |
|
 |
Rich102 Newbie

Joined: 25 Nov 2008 Posts: 4
|
Posted: Sat Dec 13, 2008 2:31 am Post subject: |
|
|
| 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 |
|
 |
|