Closing all toolbars

  • Thread starter Thread starter Shadow
  • Start date Start date
Shadow said:
How can I close all the toolbars with VBA?
I've tried the following :
-----------------------------------------------------
Dim cb
For Each cb In Application.CommandBars
If cb.Visible = True Then cb.Visible = False
Next

This seems to work -

Dim cb As Object
For Each cb In CommandBars
If cb.Type = 0 Then
DoCmd.ShowToolbar cb.NAME, acToolbarNo
End If
Next
 
Slight inconsistency in Access (Office?): for CommandBars, use the Enabled
Property to show / hide the CommandBar.

Don't bother to check whether it is enabled or not. Simply set Enabled to
False for each CommandBar.
 
thanks a million for your input


Van T. Dinh said:
Slight inconsistency in Access (Office?): for CommandBars, use the Enabled
Property to show / hide the CommandBar.

Don't bother to check whether it is enabled or not. Simply set Enabled to
False for each CommandBar.
 
Shadow said:
Thank you for trying to help and replying.
I'm receiving an error while I try to run your code.
http://www.kkkotobuki.co.jp/error.jpg

any kind of advice is much appreciated.

I'm pleased that you were able to get the problem resolved. Just for future
reference, I don't click on unknown links in newsgroups and suspect others
might feel the same way. You might be further ahead to actually post the
error message.
 
thanks one more time and sorry for posting a link to the error message.
this is the error:
---------------------------------------------------------------
Microsoft office access has encountered a problem and needs to close.
We are sorry for the inconvenience.
The information you were working on might be lost. Microsfotf office accss
can try to compact and repair your open database.
Repair my open database and restart Microsoft office access
Please tell microsoft about this problem.
We have created an error report that you cand sent to help us improve
microsoft office access. We will treat this report as confidetial and
anonymous.
What does this error report contains?
why shoul I report to microsoft
Send Error report(Button) Don't send(Button)
 
Back
Top