I’m trying to make a program, where if you click a button, it will show a MsgBox()
The text inside the MsgBox() is a text field. How do I make this?
What exactly is a “text field”? Better, attach document with exactly you want.
Do you want to get the text content of a specific
- textfield
- label
- graphical shape
- cell
- or some other object
and then display the text in a message box?
From the description, you are looking for the InputBox function.
It’s easy to use:
Sub MsgTextBox
Dim sText As String
sText = "John"
While sText <> ""
sText = InputBox ("You can instruct the user in detail on what value he should enter" & _
Chr(10) & "For example:" & Chr(10) & "Enter people's names" & Chr(10) & _
"Enter an empty line or press Cancel to end the program", "This is just a demo", sText)
If sText = "" Then
Print "Okay, everyone's gathered. Once again - hello everyone!"
Else
Print "Hello, " & sText & "!"
EndIf
Wend
End Sub
When executing a macro, it looks something like this
1 Like