Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 22

Thread: Changing Tooltip size and color

  1. #1
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location

    Changing Tooltip size and color

    How can I change the size and color of the tooltips on a 2003 Excel Userform?

    My Tooltips are very small, and was created in the Userform properties.

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Hi Simora,

    Tooltip attributes are controlled at the Windows system level - not at the application or file level. So, if you change them, all applications are affected.

    If you really want to go ahead with this, right-click on the Desktop and select Properties > Appearances > Advanced > Appearance > Item > ToolTip. From there you can play with the font attributes.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location
    macropod:

    Thanks.
    I was hoping that one could use something like altering the shape at the UserForm level. Maybe a modification of something like this
    http://en.allexperts.com/q/Excel-105...mandButton.htm

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    You could add Label1 to the userform and format it the way that you like.

    Then put this code in the userform's code module.
    Any control whose MouseMove event calls CommonToolTip will have it's ControlTipText displayed in Label1 rather than the standard tool tip box.

    A control's ControlTipText can be changed at run time or at design time. (e.g. CommandButton2)
    [VBA]Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Call CommonToolTip(ListBox1, x)
    End Sub

    Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Call CommonToolTip(TextBox1, x)
    End Sub

    Private Sub TextBox2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Call CommonToolTip(TextBox2, x)
    End Sub

    Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    With Label1
    .Caption = "null"
    .Visible = False
    End With
    End Sub

    Sub CommonToolTip(aControl As Object, Optional x As Single)
    With aControl
    If .ControlTipText <> vbNullString Then
    .Tag = .ControlTipText
    .ControlTipText = vbNullString
    End If
    Label1.Visible = (.Tag <> vbNullString)
    If Label1.Caption <> .Tag Then
    Rem if newly shown
    Label1.AutoSize = False
    Label1.Width = 150
    Label1.Height = 150
    Label1.Caption = .Tag
    Label1.AutoSize = True
    Label1.AutoSize = False

    Label1.Top = .Top + .Height
    Label1.Left = .Left + (.Width / 2) + (Label1.Width * (x > (.Width / 2)))

    Do Until Label1.Left + Label1.Width < UserForm1.Width
    Label1.Left = Label1.Left - 5
    Loop
    If Label1.Left < 0 Then Label1.Left = 5

    If (.Parent.Height) < (Label1.Top + Label1.Height) + 22 Then
    Label1.Top = .Top - Label1.Height
    End If

    End If
    End With
    End Sub

    Private Sub CommandButton2_Click()
    TextBox2.ControlTipText = "TB 2"
    End Sub[/VBA]

    Note that ComboBox1 does not have a MouseMove event and shows the standard tool tip.

  5. #5
    VBAX Regular
    Joined
    Nov 2010
    Location
    Las Vegas Nv
    Posts
    74
    Location
    you can also use the office assistant to say whatever you'd put in the tooltip

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Sean.DiSanti
    you can also use the office assistant to say whatever you'd put in the tooltip
    You aren't serious are you? No self-respecting Office user uses the office assistant.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    xld,
    You don't miss Clippy and Max ?!?

    Anyway, the Office Assistant has been depreciated since 2003(?)

  8. #8
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Quote Originally Posted by mikerickson
    Anyway, the Office Assistant has been depreciated since 2003(?)
    I think that's deprecated ...
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  9. #9
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    If you want the user to hear the tool tip, you could use code like this:
    [VBA]Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    Const Border As Long = 5
    Static Spoken As Boolean
    Static timeHack As Date

    If x < Border Or ((TextBox1.Width - x) < Border) _
    Or y < Border Or ((TextBox1.Height - y) < Border) Then
    Spoken = False
    timeHack = 0
    Else
    If timeHack = 0 Then timeHack = Now

    If (Not Spoken) And (TextBox1.ControlTipText <> vbNullString) Then
    If TimeSerial(0, 0, 1) < (Now() - timeHack) Then

    #If Mac Then
    MacScript "say "" " & TextBox1.ControlTipText & " "" "
    #Else
    Rem code for Windows
    #End If

    Spoken = True
    End If
    End If
    End If
    End Sub[/VBA]

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by macropod
    I think that's deprecated ...
    Yeah, it was depreciated (not appreciated) long before
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  11. #11
    VBAX Regular
    Joined
    Nov 2010
    Location
    Las Vegas Nv
    Posts
    74
    Location
    lol, your business must be a lot better off than mine if the people using your tools are self respecting office users. We still use 2003 over here, and manipulating the office assistant can be fun sometimes. Once i had a request to make clippy "talk to" a user a couple times a day. Nothing mean or anything, just the normal "how's your day going?", "wanna talk about it" kind of stuff. it was pretty funny, after a while she asked about it, and we just told her that 2003 was just more "user friendly"

  12. #12
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I bet you use those horrible cut-down menus as well.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  13. #13
    VBAX Regular
    Joined
    Nov 2010
    Location
    Las Vegas Nv
    Posts
    74
    Location
    i actually don't know what you're talking about, and i don't use the office assistant, but the hiring process for the agents on the floor here is basically to check them for a pulse, so it's a fair assumption they work with clippy on their screen all day

  14. #14
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    In Excel 2003, the menus (File, Edit, Format, etc.) when clicked on would typically only show the last 4 menu items that the user had used, there would be a chevrons item at the bottom to open up the rest. You had to go into Customize to get it to show all items at all times. Another MS genius idea.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  15. #15
    VBAX Regular
    Joined
    Nov 2010
    Location
    Las Vegas Nv
    Posts
    74
    Location
    ah, yeah, i mostly use hotkeys for everything so i don't even notice the menus

  16. #16
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location
    Happy New Year!

    Great ideas all. Thanks

    I took off for a moment. I'll look into the code provided.
    I actually use 2003 and if the Office Assistant can be made to provide real assistance, I'll use it if it helps the users.

  17. #17
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location
    Quote Originally Posted by Sean.DiSanti
    you can also use the office assistant to say whatever you'd put in the tooltip
    Sean.DiSanti:
    Do you happen to have the process to use the office assistant to say whatever you'd put in the tooltip. That'll be a great learning tool to have.

    Thanks

  18. #18
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location
    Quote Originally Posted by mikerickson
    You could add Label1 to the userform and format it the way that you like.

    Then put this code in the userform's code module.
    Any control whose MouseMove event calls CommonToolTip will have it's ControlTipText displayed in Label1 rather than the standard tool tip box.

    .
    mikerickson:
    Your original code worked.
    Couldn't quite get the spoken one to work yet.

    Thanks again.

  19. #19
    VBAX Regular
    Joined
    Nov 2010
    Location
    Las Vegas Nv
    Posts
    74
    Location
    Hey, i've been off for a couple of days, sorry for the slow response... here's a paste from help under the heading "Creating and modifying balloons" (this is just a brief example, a lot more is covered in that help entry

    The following example creates a balloon that helps the user select a printer. The example provides a check box option for users who want to skip the information in the balloon.
    [vba]

    Set bln = Assistant.NewBalloon
    With bln
    .Heading = "Instructions for Choosing a Printer."
    .Text = "Click OK when you've chosen a printer."
    lblTxt = "From the File menu, choose Print."
    .Labels(1).Text = lblTxt
    .Labels(2).Text = "Click Setup."
    .Labels(3).Text = "Select the name of the printer."
    .CheckBoxes(1).Text = "Skip this information."
    .BalloonType = msoBalloonTypeNumbers
    .Mode = msoModeModal
    .Button = msoButtonSetOK
    .Show[/vba]
    End With

  20. #20
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Quote Originally Posted by simora
    ...
    Couldn't quite get the spoken one to work yet.
    The code I posted will work on a Mac.
    The conditional formating has a comment asking for Windows code that will say the string TextBox1.ControlTipText .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •