Hi There,
There is 3 option that you can use for create messageboxes.
1. CommandManager.PromptMessage()
2. MsgBox.Show ====> (This one is a VB function)
3. You can create your own dialog.
For the 1st one:
Dim cmdMgr As CommandManager = application.CommandManager
answercmdMgr.PromptMessage("MESSAGE", BUTTONS, "TITLE")
So BUTTONS is some LONG variable that represents button types. Alsi this prompt message function will return an answer as LONG.
If you look at this site:
https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/msgbox-constants
You can find out what is the values and names of Buttons and which button returns which value.
The second one is more common. Its basically creates a message box and returns the answer:
MsgBox (prompt, [ buttons, ] [ title, ] [ helpfile, context ])
You can also see the explanation for it here:
https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/msgbox-function
Here is one:
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to continue ?" ' Define message.
Style = vbYesNo Or vbCritical Or vbDefaultButton2 ' Define buttons.
Title = "MsgBox Demonstration" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
Else ' User chose No.
MyString = "No" ' Perform some action.
End If
And the last option you have... You can create a form and use ShowDialog().
This is probably most complicated one so you can read this article.
https://www.javatpoint.com/vb-net-dialog-box
But all of them basically works same.
Best Regards
Devrim
If my answer is solved your problem, please mark it as Solution
Freundliche Grüße / Kind Regards