Share via

Add TextBox value to MsgBox

Anonymous
2010-11-09T20:27:55+00:00

?When I click on CommandButton1 on UserForm1 a MsgBox with the following msg

is displayed. Is there any way to replace XXXXXXXXXX with the value of

TextBox1 of UserForm1?

'Place your text here

MyNote = "This will remove XXXXXXXXXX from the list of Employee Names.

It will not remove the name from the other worksheets. Is that what you want

to do?"

'Display MessageBox

Answer = MsgBox(MyNote, vbQuestion + vbYesNo)

Microsoft 365 and Office | Install, redeem, activate | For home | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Jay Freedman 207.7K Reputation points Volunteer Moderator
2010-11-09T20:38:18+00:00

MyNote = "This will remove " & Me.TextBox1.Value

   MyNote = MyNote & " from the list of Employee Names. It will not remove the name from the other worksheets. Is that what you want to do?"

You can use the & operator to concatenate (stick together) any pair of strings, and you can build up a string in stages as in the second statement.


Jay Freedman

MS Word MVP  FAQ: http://word.mvps.org

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2010-11-09T22:19:51+00:00

    Thank you sir

    "Jay Freedman [MVP]" wrote in message news:*** Email address is removed for privacy ***...

    MyNote = "This will remove " & Me.TextBox1.Value

       MyNote = MyNote & " from the list of Employee Names. It will not remove the name from the other worksheets. Is that what you want to do?"

    You can use the & operator to concatenate (stick together) any pair of strings, and you can build up a string in stages as in the second statement.


    Jay Freedman

    MS Word MVP  FAQ: http://word.mvps.org

    Was this answer helpful?

    0 comments No comments