Inserting and removing text into a textbox on a SHEET in calc BASIC

As I can’t solve my problem I’d like to ask someone more experienced.I created simple dialog (4 fields) to let the user enter few data. After clicking “Submit” button those data should be inserted into textboxes put ON THE SHEET (not on any dialog). How to refer to those sheet texboxes in code to insert those data? Other thing is deleting those data from sheet textboxes after clicking button “Clear” on this sheet. Suppose it will be similar to inserting but how this piece of code should look like?
Thanks in advance.

See example:

' Show each Control's name on the Sheet.
' Add exclamation point to each Textbox on the sheet.
Sub Test
  Dim oSheet, oForm, oControlModel, s As String
  oSheet=ThisComponent.Sheets(0)
  oForm=oSheet.DrawPage.Forms(0)
  
  For Each oControlModel In oForm
    With oControlModel
      s=s & "Name: " & .Name 
      If .supportsService("com.sun.star.form.component.TextField") Then
        s=s & "  Text: " &  .Text
        .Text=.Text & "!"
      End If  
    End With  
    s=s & Chr(10)
  Next oControlModel  
 
  Msgbox s   
End Sub
1 Like

Also asked at Apache OpenOffice Community Forum - Inserting and removing text into a textbox on a SHEET in calc BASIC - (View topic) where there is considerable discussion.
If you cross post, please let us know that you have done so, otherwise it leads to several discussions and a waste of time because several identical answers may be posted by different users.

2 Likes

Also asked at StackOverflow - Inserting and removing text into a textbox on a SHEET in Libreoffice calc BASIC