VBA "Userform" equivalent for Calc

Does Calc have an equivalent to the Excel UserForm ?
Trying to display a multi-line text box when a pushbutton is pressed.
In Excel I have several UserForms that I set up under VBAProject and that get accessed via pushbuttons, but I can’t see an option to do this in Calc. So far all I can find is “Msgbox” via a macro but this seems to only be a one line affair.

7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
Linux 5.15

I would advise reading chapter “18. Dialogs and Controls” of the famous book by A. Pitonyak OpenOffice.org Macros Explained.

1 Like

Yes, you can create a custom user form with different controls, it requires certain skills, but it is not difficult.
Perhaps I didn’t understand this part of your question completely correctly, but MsgBox can output multi-line texts.

Sub demoMultiLine()
Dim iAnswer As Integer, sAnswer As String 
	iAnswer = MsgBox("You can use long user instructions like this one:" & Chr(10) & Chr(10) & _
				"It's " & Time() & Chr(10) & _
				"Click Yes If you agree with this statement" & Chr(10) & _
				"or click No if you would like to specify a different time" & Chr(10) & _
				"You can also click Cancel if you want to stop this farce" & Chr(10) & Chr(10) & _
				"Making a long multi-line message in this dialog is easy" & Chr(10) & _
				"if you indicate line breaks using the Chr(10) function" & Chr(10) & Chr(10) & _
				"But you must be prepared for the fact that users will not" & Chr(10) & _
				"read this text. they will shout loudly" & Chr(10) & _
				"""Redart! Come here! Faster! Something terrible happened here!""", _
				MB_YESNOCANCEL+MB_ICONQUESTION, "Demonstration of MsgBox capabilities")
	Select Case iAnswer
		Case 0
			MsgBox "It was rude! The instructions didn't say" & Chr(10) & _
				"a word that you could do this!", MB_ICONEXCLAMATION, "Did you close the dialog with the Esc key or click the red cross?"
		Case IDYES
			MsgBox "I am glad that we have come to an agreement on this issue." & Chr(10) & _
				"But according to my information it is already " & Time(), MB_ICONINFORMATION, "Yes button was clicked"
		Case IDNO
			sAnswer = InputBox("Okay, let it be. You can enter your own value." & Chr(10) & _
				"(But keep in mind that I will ignore it)", "No button was clicked", Time())
		Case IDCANCEL
' Pressing the Cancel button can also be processed	
	End Select 
End Sub
1 Like

Thank you both @sokol92 and @JohnSUN for your replies.

Slightly embarrassed to say I already had Andrew Pitonyak’s book on my machine but as a non-programmer it’s a tough read ! :crazy_face:. I had gotten as far as inserting an empty Dialog box but was stuck on how to populate it. Chapter 18 got me there in the end and I now have a pop-up dialog box with some text and an “OK” button (called via push button). I also have another button that displays some humorous guidance on how versatile the MsgBox can be!. Very amusing, and clever! :slightly_smiling_face: . So thank you both again. I may end up using both methods depending on contextual requirements. Muchas gracias :pray: :ok_hand: :+1:

1 Like

Wanted to mark both posts as Solutions but seems I can only mark one at a time :neutral_face:.
Apologies.