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.
"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
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
"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 >
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.
"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
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.
But assign the icon for this button I can't. It not have such property....