Adding Tip Text to custom toolbar in 2007

V

vbaexperimenter

I used Ron de Bruin site (http://www.rondebruin.nl/ribbon.htm) to create a
custom group and buttons, however I need my buttons to have TipText when the
mouse is put over it. I can not seem to figure out a way to do this. This is
the code for the button it is straight from Ron's site with minor changes:


<button id="Checkmark" size="normal" onAction="Checkmark" image="Checkmark"
/>
 
V

vbaexperimenter

Thanks for your help that worked. Another question unrelated, I have my
custom macros saved into an *.xlam file, which is where I saved your xml
code. When I click on the Callbacks button it isn't associating my macros
with the button. Now I don't have any vb code other then what I copy below do
I need something above or below it? Here is my macro:

Sub Checkmark()

InsertPicture13 "D:\Program Files\Microsoft
Office\Office12\Tickmarks\Check_mark.bmp", ActiveCell, True, True
End Sub

Sub InsertPicture13(PictureFileName As String, TargetCell As Range, _
CenterH As Boolean, CenterV As Boolean)
' inserts a picture at the top left position of TargetCell
' the picture can be centered horizontally and/or vertically
Dim p As Object, t As Double, l As Double, w As Double, h As Double
If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
If Dir(PictureFileName) = "" Then Exit Sub
' import picture
Set p = ActiveSheet.Pictures.Insert(PictureFileName)
' determine positions
With TargetCell
t = .Top
l = .Left
If CenterH Then
w = .Offset(0, 1).Left - .Left
l = l + w / 2 - p.Width / 2
If l < 1 Then l = 1
End If
If CenterV Then
h = .Offset(1, 0).Top - .Top
t = t + h / 2 - p.Height / 2
If t < 1 Then t = 1
End If
End With
' position picture
With p
..Top = t
..Left = l
End With
Set p = Nothing

End Sub


Other then the changes I showed you in your xml code nothing has changed.
What am I doing wrong?
 
R

Ron de Bruin

Hi

When you have the file open in the Custom UI editor
Click on the "Create callbacks" button

Copy what you see in a module of the workbook

You see something like this

'Callback for customButton1 onAction
Sub Macro1(control as IRibbonControl)

End Sub

You can add the code in this callback

Sub Macro1(control as IRibbonControl)
InsertPicture13 "D:\Program Files\Microsoft
Office\Office12\Tickmarks\Check_mark.bmp", ActiveCell, True, True
End Sub

Or call the macro you have

Sub Macro1(control as IRibbonControl)
Call Checkmark
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top