Userform controls' balloon tooltips not showing in Excel 64-bit

rplazzotta

New Member
Joined
Oct 28, 2021
Messages
41
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Can anyone help with my BalloonToolTips class? It works in Excel 32-bit (W7 and W10) but not in Windows 10 Excel 64-bit, even though it compiles without errors.
It's old VB6 code that I've adapted for VBA (VBA only exposes hWnds for Frames and Listboxes).
So I put any controls other than the above that require a multiline "ControlTipText" in a caption-less Frame with the Userform's bordercolor and I put the control's ControlTipText in that of the Frame.
It's the only way I've found to provide multiline tooltips for such controls.

But they just don't show in Excel 64-bit. Any help would be greatly appreciated.

http://www.wot.fr/BalloonToolTipDemo.zip

Richard
 
Thanks Jaafar. One little thing (that was the case before your last post):
For some bizarre reason, tooltips with 2 or more lines but with no icon or title don't recognize vbNewLine (whereas those with icon and title are OK)!
compared.jpg
My clumsy workaround above is:
.Title = Chr(160) & vbNullChar
but predictably this adds an unwanted blank line
I've tried commenting out .Title and assigning just vbNullChar to it, but that doesn't work.
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Thanks Jaafar. One little thing (that was the case before your last post):
For some bizarre reason, tooltips with 2 or more lines but with no icon or title don't recognize vbNewLine (whereas those with icon and title are OK)!
View attachment 52146
My clumsy workaround above is:
.Title = Chr(160) & vbNullChar
but predictably this adds an unwanted blank line
I've tried commenting out .Title and assigning just vbNullChar to it, but that doesn't work.
Are you setting the Multiline attribute in the uTTData to TRUE ? I think, you forgot to do that that's why you are having the problem you describe.
 
Upvote 0
Are you setting the Multiline attribute in the uTTData to TRUE ? I think, you forgot to do that that's why you are having the problem you describe.
Sorry Jaafar, it's more complicated than just setting .Multiline. (Reminder: I'm developing an application for 3 platforms: W7, W10 Excel 32-bit and W10 Excel 64-bit).
For some reason, in Windows 10 (both Excel 32-bit and W10 Excel 64-bit), tooltips with 2 or more lines but with no icon or title just don't show at all.
But they do show in Windows 7 (Excel 32-bit).
Below is the relevant part of my userform pre-processing code
(I store the tooltip data in ControlTipText, encoded as follows:
'<Title:xxxx><Icon:n><BackColor:xxxx><TextColor:xxxxx>The text itself|possibly multiline,|pipe character symbolizing vbNewLine
'The first four <...> are optional, defaulting to no title, no icon, SystemInfoBackColor = True and SystemInfoTextColor = True)

Userform code pre-processing each Control with a ControlTipText:

VBA Code:
Function MakeTTData(Ctrl As MSForms.Control, TTData As ToolTipData) As Boolean
'...local variables declared here
S = Ctrl.ControlTipText 'in this example, the control is a label, S is a local variable
'example: "e.g. '? titre*' will find all French expressions beginning with one letter|folllowed by ' titre' and sth else (e.g. à titre comparatif)"
If Len(S) = 0 Then
       Exit Function
End If
Ctrl.ControlTipText = "" 'so it doesn't display!
With TTData
       .cbSize = LenB(TTData)
       NBLines = NbOcc("|", S) + 1    'the | character symbolizes vbNewLine. I don't add a trailing | to the text
       Multiline = (NBLines > 1)      'local variables
       If InStr(1, S, ">") = 0 Then    'Just line(s) of text, no encoded icon, title, backcolor or textcolor., so [B]APPLY DEFAULTS[/B]
           .Icon = TTI_NONE
           .Title = vbNullChar '[B]I've tried String(64, vbNullChar), I've also tried commenting out this line, no difference in Windows 10[/B]
           .Text = Replace(S, "|", vbNewLine)
           .SystemInfoBackColor = True
           .SystemInfoTextColor = True
           .Multiline = Multiline
           .Styles = TTS_ALWAYSTIP + TTS_NOPREFIX + TTS_BALLOON
           .DelayTime = 3 + IIf(Multiline, NBLines - 1, 0)
          .BeepSound = False
           .Position = MousePos
           ' So one-liners show, but tooltips with 2 or more lines DON'T show in Windows 10 (but DO in Windows 7)
       Else
   '           ..... the rest works perfectly on all 3 platforms

Can you see any reason why?
 
Upvote 0
@rplazzotta

Try the following update and see what happens : Workbook update

I have removed the Multiline attribute from the uTTData UDT so the user will now need to explicitly add vbNewLine to the Tooltip text at each line break.

Let me know the outcome so I can post the new working code.
 
Upvote 0
@rplazzotta

Try the following update and see what happens : Workbook update

I have removed the Multiline attribute from the uTTData UDT so the user will now need to explicitly add vbNewLine to the Tooltip text at each line break.

Let me know the outcome so I can post the new working code.
Thanks Jaafar, position is fine, and multline tooltips WITHOUT title and icon are now good in Windows 10, both Excel 32-bit and 64-bit.
In Windows 7 (Excel 32-bit) the tooltips are all over the place (see screenshot below), but I assume this is not the full working code.
Report29-11-21.jpg
 
Upvote 0
I could reproduce that problem in Win 7 pro SP 1. Strangely enough, the code worked fine when tested on a different pc also Win7 pro SP1 !.

Anayways, I think what is causing issues here is the fact that the code uses a shared tooltip between all controls which requires the tooltip to be updated as it moves from one control to another. Updating the Styles, specially to the rectangular (box) style, can be problematic.

If you only need the style of TTS_BALLOON for your controls (as shown in the above screenshot) and you don't care about the rectangular\box style, I can post some new code later on when I get home which hopefully should fix the problem... When I have more time, I will take a closer look and see how I can improve it so it works for all styles..

Please, let me know.
 
Upvote 0
I could reproduce that problem in Win 7 pro SP 1. Strangely enough, the code worked fine when tested on a different pc also Win7 pro SP1 !.

Anayways, I think what is causing issues here is the fact that the code uses a shared tooltip between all controls which requires the tooltip to be updated as it moves from one control to another. Updating the Styles, specially to the rectangular (box) style, can be problematic.

If you only need the style of TTS_BALLOON for your controls (as shown in the above screenshot) and you don't care about the rectangular\box style, I can post some new code later on when I get home which hopefully should fix the problem... When I have more time, I will take a closer look and see how I can improve it so it works for all styles..

Please, let me know.
My Win 7 PC is also Pro, SP1. Bizarre that it works on one of your Win 7 PCs and not the other!
When you say "the code uses a shared tooltip between all controls", I don't think that's the problem, because each tooltip shows a different Control name (in your latest ControlsToolTipsPos.xls).
Anyway, there's really no urgency. Please take your time Jaafar, I really appreciate you taking the time :)
I'm happy to wait until it works on all three platforms (in my application, style needs to be consistent across 4 or 5 userforms, and my preference is defnitely balloon style).
 
Upvote 0
When you say "the code uses a shared tooltip between all controls", I don't think that's the problem, because each tooltip shows a different Control name (in your latest ControlsToolTipsPos.xls).
No. There is only one single shared tooltip for all the userform controls... The tooltip is automatically updated with the new text, color etc. when the mouse is over a new control.

Using a shared tooltip is done on purpose because vba form controls don't have a hwnd that can be associated with the tooltip and also in order to avoid overloading the application with various tooltips which could potentially slow down the program and would require proper cleaning up when finished.

Anyway, I rewrote much of the code to fix all the issues encountered so far. My last few tests on different platforms seem to be ok.

Here is a workbook update

Hopefully, this last update should be bug-free ... Let me know if it now works for you so I can post the new class code here for future reference.
 
Upvote 0
Thanks Jaafar, it now works identically on all 3 platforms (W7, W10XL32 and W10XL64), with or without icon/title, multiliners and position OK too.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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