Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Mon, 29 Sep 2008 02:56:37 -0700 (PDT),    group: microsoft.public.word.vba.general        back       


How to assign ToolTip for button on tool bar?   
Hello.
I placed button of my macro on the tool bar. When I bring mouse cursor
to this button I get ToolTip with the name of my macro. But I can't
assign own ToolTip and own icon for this button. Is it possible and
how?
Thank you very much.
date: Mon, 29 Sep 2008 02:56:37 -0700 (PDT)   author:   avkokin

Re: How to assign ToolTip for button on tool bar?   
"avkokin"  wrote in message 
news:34ac87fc-96a1-41fc-8edd-65e2ffe07464@r66g2000hsg.googlegroups.com...
> Hello.
> I placed button of my macro on the tool bar. When I bring mouse cursor
> to this button I get ToolTip with the name of my macro. But I can't
> assign own ToolTip and own icon for this button. Is it possible and
> how?
> Thank you very much.

You can't do this through the user interface. You can only do this using 
VBA. Assign the string you want to the button's ToolTipText property.


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
date: Mon, 29 Sep 2008 11:54:56 +0100   author:   Jonathan West

Re: How to assign ToolTip for button on tool bar?   
Hello Jonathan.
I should be glad to assign my own text for ToolTip but I unknow how.
That is my code for button on toolbar on left position:

Option Explicit

Dim cb As CommandBar
Dim mBtn As CommandBarButton
Dim cBtn As CommandBarButton
Dim i As Long
Dim rf As RecentFile

Sub buttonMenu()
On Error Resume Next

Set cb = CommandBars.Add("btnPopup", msoBarPopup)


For Each rf In Application.RecentFiles
   If Len(Dir(rf.Path & "\" & rf.Name)) = 0 Then
      Application.RecentFiles(rf.Index).Delete
   End If
Next rf


For i = 1 To Application.RecentFiles.Count

   Set mBtn = cb.Controls.Add(msoControlButton)
   With mBtn
      .Caption = Application.RecentFiles(i)
      .Tag = Application.RecentFiles(i).Path & "\" &
Application.RecentFiles(i).Name
      .OnAction = "openRF"
   End With
Next i
   With CommandBars.ActionControl
      cb.ShowPopup .Left + 25, .Top + .Height - 24
   End With
   Set cb = Nothing
   Set mBtn = Nothing
End Sub

Sub openRF()
Documents.Open CommandBars.ActionControl.Tag
End Sub
date: Mon, 29 Sep 2008 04:16:36 -0700 (PDT)   author:   avkokin

Re: How to assign ToolTip for button on tool bar?   
"avkokin"  wrote in message 
news:79e3b405-888c-42dc-abd1-996f09c45b6a@z66g2000hsc.googlegroups.com...
> Hello Jonathan.
> I should be glad to assign my own text for ToolTip but I unknow how.
> That is my code for button on toolbar on left position:

I've added a line of code below that applies the name of the recent file to 
the tooltip of the appropriate button. You can of course have the tooltip 
contain something else if you prefer.


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

>
> Option Explicit
>
> Dim cb As CommandBar
> Dim mBtn As CommandBarButton
> Dim cBtn As CommandBarButton
> Dim i As Long
> Dim rf As RecentFile
>
> Sub buttonMenu()
> On Error Resume Next
>
> Set cb = CommandBars.Add("btnPopup", msoBarPopup)
>
>
> For Each rf In Application.RecentFiles
>   If Len(Dir(rf.Path & "\" & rf.Name)) = 0 Then
>      Application.RecentFiles(rf.Index).Delete
>   End If
> Next rf
>
>
> For i = 1 To Application.RecentFiles.Count
>
>   Set mBtn = cb.Controls.Add(msoControlButton)
>   With mBtn
>      .Caption = Application.RecentFiles(i)
>      .Tag = Application.RecentFiles(i).Path & "\" &
> Application.RecentFiles(i).Name
>      .OnAction = "openRF"

    .TooltipText = Application.RecentFiles(i).Name

>   End With
> Next i
>   With CommandBars.ActionControl
>      cb.ShowPopup .Left + 25, .Top + .Height - 24
>   End With
>   Set cb = Nothing
>   Set mBtn = Nothing
> End Sub
>
> Sub openRF()
> Documents.Open CommandBars.ActionControl.Tag
> End Sub
>
date: Mon, 29 Sep 2008 13:12:32 +0100   author:   Jonathan West

Re: How to assign ToolTip for button on tool bar?   
Jonathan, sorry but it not work. I need to assign ToolTip not for
items menu (anyway it not work too), and for the button of my macro.
Please see the screenshot (http://www.box.net/shared/uyipaeyz3d).
There showed ToolTip  with name of the macro (buttonMenu). For this
button I need to assign the ToolTip.
But how do it for my code (above)?
Thank's.
date: Mon, 29 Sep 2008 06:44:39 -0700 (PDT)   author:   avkokin

Re: How to assign ToolTip for button on tool bar?   
"avkokin"  wrote in message 
news:c2b1d75e-bc7b-41e3-8812-07322de5d482@a1g2000hsb.googlegroups.com...
> Jonathan, sorry but it not work. I need to assign ToolTip not for
> items menu (anyway it not work too), and for the button of my macro.
> Please see the screenshot (http://www.box.net/shared/uyipaeyz3d).
> There showed ToolTip  with name of the macro (buttonMenu). For this
> button I need to assign the ToolTip.
> But how do it for my code (above)?
> Thank's.

How do you identify that button? For instance, what is the name of the 
toolbar it is on?


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
date: Mon, 29 Sep 2008 15:05:49 +0100   author:   Jonathan West

Re: How to assign ToolTip for button on tool bar?   
Dear Jonathan. I found the plase whither I should insert the property
"ToolTip":

With CommandBars.ActionControl
      cb.ShowPopup .Left + 25, .Top + .Height - 24
     .ToolTip Text = "My own name of the button"   ' !!! HERE !!!
End With

Thank you. I am sorry to trouble you.
Sincerely, Anton.
date: Mon, 29 Sep 2008 10:17:28 -0700 (PDT)   author:   avkokin

Re: How to assign ToolTip for button on tool bar?   
But assign the icon for this button I can't. It not have such
property....
date: Mon, 29 Sep 2008 10:26:22 -0700 (PDT)   author:   avkokin

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us