Userform initialise code using also characters

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,237
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I’m trying to put some text in Textbox2 but there are also characters involved of which I stuck with.

Example of what I’m trying to insert including the brackets & comma

(“Put your text here please”),

Please advise Thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Here it is stored as a variable. You can test this piece of code to see if that is what you want. Then just assign the variable's value to the text box.

VBA Code:
Private Sub Str_ing()
Dim strA As String
strA = "(" & """" & "Put your text here please" & """" & "),"
Debug.Print strA
End Sub
 
Upvote 0
Thanks but i dont undertstand that.
Can you advise the code so i cant just copy it please
 
Upvote 0
VBA Code:
TextBox1.Value = "(" & """" & "Put your text here please" & """" & "),"

Change "TextBox1" to whatever you have named the text box.
 
Upvote 0
Keep getting syntax error,d you see why

Rich (BB code):
Private Sub UserForm_Initialize()
TextBox2.Value = "(" & """" & "(MsgBox "ENTER YOUR TEXT HERE", & """" & "),"
End Sub

Im trying to put this is the TextBox
(MsgBox "ENTER TEXT HERE"),
 
Upvote 0
Maybe this:

VBA Code:
Textbox2.Value = "(MsgBox " & """" & "ENTER TEXT HERE" & """" & "),"

or

VBA Code:
TextBox2.Value = "(MsgBox " & """" & "ENTER TEXT HERE" & """" & "),"
 
Upvote 0
Solution

Forum statistics

Threads
1,215,639
Messages
6,125,970
Members
449,276
Latest member
surendra75

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top