how to from Dialog to Calc?

hi i tryed a lot of different to ways

 oCell=oSheet.getCellByPosition(2,1)

DONT WORK -> oCell = oDialog.getControl("TextField1") (return that there is no specific variable)

to do that:

sub AtosPjGrupo3Show
    DialogLibraries.LoadLibrary("Standard")
    oAtosPjGrupo3 = CreateUnoDialog( DialogLibraries.Standard.AtosPjGrupo3 )
    oAtosPjGrupo3.Execute()
End Sub


Sub EditaTeste
Dim oDocument As Object, oSheet As Object, oCell As Object
   oDocument=ThisComponent
   oSheet=oDocument.Sheets.getByName("Planilha1")
   oCell=oSheet.getCellByPosition(2,1)
   oCell.Value = AtosPjGrupo3.txtProtocolo.Value

   MsgBox "Salved"

End Sub

but it return basic error, undefined variable ¬¬!! why? i think im using the incorrect syntax to access the dialog itens

and yes the textbox name = txtProtocolo

NO ONE? :(!

The cuestion is closed, but if someone is interested…
You must terminate the dialog with the function endDialog().

Sub TerminateButton(oEvent).
    oEvent.Source.Context.endDialog(Value)
End Sub

Sub AtosPjGrupo3Show
    ...
    AtosPjGrupo3Show=oAtosPjGrupo3.Execute()
End Sub

Sub EditaTeste
    ...
    oCell.Value = AtosPjGrupo3Show
    ...
End Sub

Source:
https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Working_With_Dialogs