I have a calc sheet with a form that I wish to revise via dialog box. The macro will update the form okay, the only issue is that it is not retrieving the text from the controls in the dialog. I tried this simpler example and got the same issue, will not receive the text.
Sub GetTextboxText
’ Load the dialog library (if necessary)
DialogLibraries.LoadLibrary(“Standard”)
’ Load your dialog
Dim myDialog As Object
myDialog = CreateUnoDialog( DialogLibraries.Standard.Dialog2 )
’ Get a handle to the textbox control
Dim myTextBox As Object
myTextBox = myDialog.getControl(“TextField1”) ’ Replace “TextField1” with your textbox name
’ Get the text from the textbox
Dim textboxContent As String
textboxContent = myTextBox.Text
’ Display the text (for demonstration)
MsgBox("Text from textbox: " & textboxContent)
End Sub
I also tried using the Model.getbyName method and the same thing happens. I do not get an error, I get a pop up msgbox that read "Text from textbox: " and NOTHING. I typed the text “test” into the box and I can still see it there, it is just not being retrieved in the macro. What is missing?