Disable customization of command bar

G

Gina

Hi all.

What I am trying to do is to disable the appearing of point ' customize'
when right-clicking on the only commandbar
all is hidden but still on right-clicking the 'invoice' command bar there is
the option of customization ...

here's my code:

Dim i As Integer
i = 1

Application.WindowState = wdWindowStateNormal

While i < ActiveDocument.CommandBars.Count - 1

If ActiveDocument.CommandBars(i).Name <> "Invoice" Then
ActiveDocument.CommandBars(i).Enabled = False
Else
ActiveDocument.CommandBars(i).Enabled = True
End If

Debug.Print i
i = i + 1
Wend

CommandBars("Invoice").Enabled = True
CommandBars.AdaptiveMenus = False

Any help and idea would be highly appreciated !!
Thx, Gina
 
T

Tony Jollans

Sorry, you are correct - DisableCustomize is not in 2000. Without it I don't
think you can completely stop user customization.

I have had a quick look at your other thread and will study it later. What
you want is just about achievable but is a lot of work and not 100%
effective (users can open documents without running macros if they want, for
example). It also requires a lot more than just disabling toolbars; there
are all the shortcut key combinations to deal with as well.
 
G

Gina

Thanks Tony ....

oh ... such a pity ...
basically the main thing I would want is the right-click on the remaining
toolbar 'Invoice' - the customization !!!
.... where they can get what they want
there is no'right-click' anymore nowhere in the doc created from
Invoice1.dot .... but still with the remaining toolbar .... oh dear

I changed my code so normal.dot and any doc created from it and from any
other *.dot apart from the Invoice1.dot aren't anymore affected ....so far
so good but all the points you made have not been addressed yet...

I am really looking forward to your ideas, please !!!

Gina

***
Sub HideAllToolbars()
Dim i As Integer
i = 1

Application.WindowState = wdWindowStateNormal

If ActiveDocument.AttachedTemplate = "Invoice1.dot" Then
If ActiveWindow.Active = True Then

Do
If Not (ActiveDocument.CommandBars(i).Name = "Invoice") Then
ActiveDocument.CommandBars(i).Enabled = False
Else
ActiveDocument.CommandBars(i).Enabled = True
End If
i = i + 1
Loop While i <= (ActiveDocument.CommandBars.Count)
End If
CommandBars.AdaptiveMenus = False
Else
Do
ActiveDocument.CommandBars(i).Enabled = True
i = i + 1
Loop While i <= (ActiveDocument.CommandBars.Count )
CommandBars.AdaptiveMenus = True

End If

CommandBars("Invoice").Enabled = True
CommandBars("Invoice").Visible = True

End Sub
***
Sub AutoNew()
HideAllToolbars
End Sub
***
Sub AutoExit()
HideAllToolbars
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