To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=31766
------- Additional comments from [EMAIL PROTECTED] Sun Mar 12 22:29:00 -0800 2006 ------- I'm seeing this as well. Named ranges on a sheet downloaded from http://www.boardgamegeek.com/fileinfo.php?fileid=15693 return 0 as the sheet number when calling getReferencePosition(). Deleting and re-adding the named range causes the function to work correctly. The function shown below causes an error when attempting to get the Cities named range from that sheet which is on the AST tab. It incorrectly goes to the instructions tab (tab 0) and fails to find the range. Function getNamedRange(rngname As String, Optional oDoc) Dim oSheet 'Sheet containing the named range Dim oNamedRange 'The named range object Dim oCellAddr 'Address of the upper left cell in the named range Dim oRanges 'All of the named ranges If IsMissing(oDoc) Then oDoc = ThisComponent oRanges = oDoc.NamedRanges If NOT oRanges.hasByName(rngname) Then MsgBox "Sorry, the named range " & rngname & _ " does not exist" & CHR$(10) & _ "Current named ranges = " & CHR$(10) & _ Join(oRanges.getElementNames(), CHR$(10)) Exit Function End If REM The oNamedRange object supports the XNamedRange interface oNamedRange = oRanges.getByName(rngname) Print rngname & " = " & oNamedRange.getContent() oCellAddr = oNamedRange.getReferencePosition() REM Now, get the sheet that matters! oSheet = oDoc.Sheets.getByIndex(oCellAddr.Sheet) Print "Is on Sheet " & oSheet.Name REM You can then use the current controller REM to select what must be selected. REM select ( VARIANT ) REM setActiveSheet ( OBJECT ) REM setFirstVisibleColumn ( LONG ) REM setFirstVisibleRow ( LONG ) oDoc.getCurrentController().setActiveSheet(oSheet) REM The sheet can return the range based on the name REM oSheet.getCellRangeByName(rngname) REM The sheet can also return a range by position, if you know it. REM This selects the ENTIRE range Dim oRange oRange = oSheet.getCellRangeByName(rngname) getNamedRange = oRange End Function --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]