Disable toolbars

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
How can I disable all Access standard toolbars when the database starts?
I already tried the Autoexec macro, but I just can disable one at a time. It
must be like this?
Thank you.
Best regards.
 
hi,
How can I disable all Access standard toolbars when the database starts?
I already tried the Autoexec macro, but I just can disable one at a time. It
must be like this?

Dim Bar As Office.CommandBar

For Each Bar In Application.CommandBars
Bar.Visible = False
Next Bar


mfG
--> stefan <--
 
hi,
Option Compare Database
Use here in every module an Option Explicit.
However, when I open the application, it appears an error saying that he has
some problem with the 'Dim Bar As Office.CommandBar' statement.
Can you guess why?
Yup, i forgot to mention that you have to set a reference to the
Microsoft Office library in the VBA IDE.


mfG
--> stefan <--
 
hi,
And how can I do that reference? It is easy?
I only have a german localized version. In this you find it under the
menu Extras\References.


mfG
--> stefan <--
 
Hello again, Stefan.
I already installed tthe reference library. But now appears to be a problem
with the expression 'Bar.Visible = False'; I believe is the 'Bar' keyword.
Do I addin the wrong reference?

Acores
 
hi,
I already installed tthe reference library. But now appears to be a problem
with the expression 'Bar.Visible = False'; I believe is the 'Bar' keyword.
Do I addin the wrong reference?
Nope. I also forgot the necessary error handler. The entire method:

Public Sub DisableBars()

On Local Error Resume Next

Dim Bar As Office.CommandBar

For Each Bar In CommandBars
Bar.Visible = False
Next Bar

End Sub


The Resume Next is needed as not all CommandBars have the Visible property.


mfG
--> stefan <--
 

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

Back
Top