Assigning control tip text

K

kirkm

Can you add a linefeed programicably?

I'm finding chr$(13) and vblf etc. just print a square in the text.

Thanks - Kirk
 
S

Simon Lloyd

Don't use the string $, you can use a number of way
Code
-------------------
MsgBox "This is a" & vbLf & "test for" & Chr(10) & "adding new" & vbNewLine & "Lines!

-------------------
each of the new line commands can be used on thier own or mixed a
seen, but best practice would dictate that you stick with one

kirkm;231004 said:
Can you add a linefeed programicably

I'm finding chr$(13) and vblf etc. just print a square in the text

Thanks - Kir

--
Simon Lloy

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com
 
K

kirkm

vbLf should work fine.

Code:
--------------------
Sub Test()
Selection.Value = "Did it " & vbLf & "work?"
End Sub

--------------------

Seems the answer is No, not in a control tip text string.

Hope that's right... so often there's more to it...
 
D

Dave Peterson

Is this on a userform?

If yes:

Saved from a previous post.

How about just putting a label over the control and that control in a frame.

Then when you mouse over the frame, it'll hide the label. But when you mouse
over the control, you'll show the label.

Option Explicit
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = True
End Sub
Private Sub Frame1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = False
End Sub
 
K

Kenneth Hobson

Similar to what Dave said, here is another Label method for a pseudo tooltip
method on a userform.

Private Sub UserForm_Initialize()
Label1.Visible = False
End Sub

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Label1.Visible = False
End Sub

Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
With Label1
.Caption = "CommandButton1:" & vbCrLf & "Line2"
.Left = CommandButton1.Left
.Top = CommandButton1.Top - 30
.Visible = True
End With
End Sub
 
L

Leith Ross

Hello kirm,

Dave's suggestion is the easiest to implement. Again, if this on
UserForm you can create true multi-line ToolTips. This requires using
lot of Windows API calls to accomplish the task. Thought you might lik
to know

--
Leith Ros

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/
 
Top