-
Solved: Disable Close Button on Floating Toolbar
Hopefully this is a small request...
Can you disable the close button on a custom floating toolbar?
What I need is for the custom floating toolbar I created (contains custom button to perform macro) to always be open and the user not to be able to close it.
I would like to keep it floating as it helps the user know where to click when they complete - ie right in front of them regardless where they are on the page.
Thanks - so close...
-
The protection property is the one you want. If you want to use multiple protection constants, just add them.
[VBA]Option Explicit
Public Sub MakeAnnoyingBar()
Dim cb As Office.CommandBar
Set cb = ThisDocument.CommandBars.Add("DontDoThis", msoBarFloating)
cb.Protection = msoBarNoChangeVisible + msoBarNoCustomize + msoBarNoChangeDock + msoBarNoMove + msoBarNoResize
With cb.Controls.Add(Office.MsoControlType.msoControlButton)
.FaceId = 17
.Style = Office.MsoButtonStyle.msoButtonIconAndCaption
.Caption = "Foo"
End With
cb.Visible = True
End Sub[/VBA]
Cordially,
Aaron
Keep Our Board Clean! - Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
- Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.
-
Oorang,
Thanks for the code help.
I added the following to have the button run my macro (fyi for others)
[VBA]
.OnAction = "New_Doc"
[/VBA]
Appears to be working great for the template by calling it from Document_Open () to run MakeAnnoyingBar. For some reason, when opening the word doc that references the template, the toolbar is not created. I should be able to solve that part though.
Closing this question as solved. Thanks again!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules