| View previous topic :: View next topic |
| Author |
Message |
daniel2003 Newbie

Joined: 23 Oct 2003 Posts: 4
|
Posted: Fri Oct 31, 2003 12:59 am Post subject: check if sheet exists |
|
|
hello,
how can i check if a sheet exists in the openoffice calc?
in vba i write
if sheets("blabla").activate = true
msgbox("exist")
else
msgbox("not exist")
end if
thanks
daniel |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Fri Oct 31, 2003 8:52 am Post subject: |
|
|
Can you use getByName() or hasByName()?
getByName() would return the sheet.
hasByName() would return a true/false whether the sheet is present in the collection.
| Code: | oCalcDoc = ThisComponent
oSheets = oCalcDoc.getSheets()
If oSheets.hasByName( "Sheet2" ) Then
MsgBox( "This spreadsheet DOES have a sheet named Sheet2." )
EndIf
If oSheets.hasByName( "MeowMix" ) Then
MsgBox( "This spreadsheet DOES have a sheet named MeowMix." )
EndIf
oSheet = oSheets.getByName( "Sheet2" )
' Change cell B2
oSheet.getCellByPosition( 1, 1 ).setFormula( "July" )
' Change cell C2
oSheet.getCellByPosition( 2, 1 ).setValue( 2856 )
|
_________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
daniel2003 Newbie

Joined: 23 Oct 2003 Posts: 4
|
Posted: Tue Nov 04, 2003 3:49 am Post subject: |
|
|
Hello,
thanks
daniel |
|
| Back to top |
|
 |
|