Como utilizar string resultado de uma Sub em outra Sub

Caros, tenho as seguintes sub

sub OrdeDesc 
Dim Doc As Object
Doc = ThisComponent
 	Dim oSheetDSC,oDSCRange As Object
   	Dim aSortFields(0) As New com.sun.star.util.SortField
  	Dim aSortDesc(0) As New com.sun.star.beans.PropertyValue
	oSheetDSC = ThisComponent.Sheets.getByindex(0)
  	oDscRange = oSheetDSC.getCellRangeByName("a1:b15")	
  	aSortFields(0).Field = 0
  	aSortFields(0).SortAscending = false
  	aSortDesc(0).Name = "SortFields"
  	aSortDesc(0).Value = aSortFields()
  	oDSCRange.Sort(aSortDesc())
End Sub

e

sub cursor
	Dim Doc as object
	Doc = ThisComponent
	Dim Cur As Object ' cursor on the cell
	Dim Range As Object ' the used range
	Dim oSheet as object
	Dim RowF, ColF,RowI, ColI as LONG
	Dim RangeName as string
	
       oSheet = ThisComponent.Sheets.getByIndex(0)
	Cur = oSheet.createCursorByRange(oSheet.getCellRangeByName("A1"))
	Cur.gotoEndOfUsedArea(True)
	Range = oSheet.getCellRangeByName(Cur.AbsoluteName)
	
	RowF = Range.RangeAddress.EndRow
	ColF = Range.RangeAddress.EndColumn
	RowI = Range.RangeAddress.StartRow
	ColI = Range.RangeAddress.StartColumn
	RangeName = Range.AbsoluteName
	  	
end sub

Individualmente funcionam. Mas não consigo (não sei se é possível) utilizar o resultado (“RangeName”) dessa segunda sub como input em
oDscRange = oSheetDSC.getCellRangeByName(“a1:b15”)
da primeira.
Alguém sabe se é possível e como fazê-lo?

obrigado

Arquivo exemplo:
Ask_OrdenarIntervalo.ods (13,2,KB)
.
Segue solução:

Option Explicit			'	Força a declaração de variáveis

Sub OrdenarDecrescente(Optional oDoc)
Dim oSheet			As Object
Dim oRange			As Object
Dim oSortFields(0)	As New com.sun.star.util.SortField
Dim oSortDesc(0)	As New com.sun.star.beans.PropertyValue
Dim sRange$
	
	REM Obtem documento
	oDoc = IIf(isMissing(oDoc), ThisComponent, oDoc)
	
	REM Obtem 1ª planilha
	oSheet = oDoc.Sheets.getByIndex(0)
	
	REM Obtem endereço do intervalo a ordenar como String
	sRange = ObterIntervalo(oSheet)
	
	REM Obtem intervalo para ordenar
	oRange = oSheet.getCellRangeByName(sRange)
  	
	REM Índice sempre inicia em 0 (Ex.: Coluna A = 0, Coluna B = 1, ...)
	oSortFields(0).Field = 0					' Qual coluna/campo ordenar?
	oSortFields(0).SortAscending = False		' Crescente ou decrescente?
  	
	REM Insere as opções anteriores no Descritor de ordenação
	oSortDesc(0).Name = "SortFields"
	oSortDesc(0).Value = oSortFields()
  	
	REM Ordena intervalo
	oRange.Sort(oSortDesc() )
End Sub

Function ObterIntervalo(Optional pSheet As Object) As String
Dim oCursor	As Object
	
	REM Obtem planilha ativa
	If isMissing(pSheet) Then pSheet = ThisComponent.CurrentController.getActiveSheet()
	
	REM Cria cursor na célula A1
	oCursor = pSheet.createCursorByRange( pSheet.getCellByPosition(0, 0) )
	
	REM Leitura do intervalo preenchido
	oCursor.gotoEndOfUsedArea(True)
	
	ObterIntervalo = oCursor.AbsoluteName
	  	
End Function

Valeu, Felipe. Era isso mesmo