Good day.
- Trying to insert a bullet in a text box to make point form notes. I can use either a button or when pressing enter (preferred)
- Using enter seems to work but it seems like it retains memory of other bullets I've entered and deleted. PLUS it seems to select all text on it's own and when you press the right arrow to start typing it leaves the text box record. Very frustrating.
- So all in all I found one that works but seems to encompass some weird behavior. I don't want or need all the hoopla, just enter a bullet on button down and leave it at that, no special activities, no special selection behaviors, just put a place a bullet the LEAVE!!! No more stupid code.
This doesn't work properly. After trying several times then deleting the bullets, another enter gives: "Some text for the technique••••• "
Private Sub Notes_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Notes.Value = "" Then
'Notes.Value = "• "
Else
Notes.Value = Notes.Value & Chr(10) & "• " '[COLOR=#ff0000]KeyCode = 0[/COLOR]
End If
End If
End Sub
This doesn't work
Option Explicit
Dim oTextbox As MSForms.TextBox
Private Sub CommandButton1_Click()
Dim doClip As DataObject
Dim bulletStr As String
Set doClip = New DataObject
bulletStr = "? "
doClip.SetText bulletStr
doClip.PutInClipboard
' With Me.TextBox1 ' <<<<<<<<<<<<<<<<<<<<<< what did you expect
With oTextbox
.Paste
.SetFocus
End With
End Sub
This gives "User-defined type not defined" errors
Ok...you need something different.
For each textbox you want to have this functionality, go in properties > Other Tab > Tag property and write: Bullet
Replace the Button with a Label. (label doens't get focus)
Go in properties and in Hyperlink type a space -
Than in OnClick event type:
If me.ActiveControl.Tag = "Bullet" Then
Me.ActiveControl = Me.ActiveControl & VbCrLf & Chr(149)
Endif
If you have the focus in one of those textbox fileds and than click on that Label, a bullet will be added at the end on a new line.
How can it be so difficult?? Some of this code is from 2005, 2018 etc. Everything seems to have changed.
CW