Hide all menubars even 'Worksheet Menu Bar'

  • Thread starter Thread starter Filips Benoit
  • Start date Start date
F

Filips Benoit

Dear All,

How can I hide all menubars by code when opening excel from Access.

Thanks,

Filip
 
Hi Filips

Try this in Access

Sub test()
Dim bar
On Error Resume Next
Set xl = GetObject(, "Excel.Application")
If xl Is Nothing Then
Set xl = GetObject("", "Excel.Application")
xl.workbooks.Open "c:\Data\test3.xls"
xl.UserControl = True
xl.Visible = True
For Each bar In xl.CommandBars
bar.Enabled = False
Next
End If
AppActivate "Microsoft Excel"
End Sub
 
Dim ocb As Object

For Each ocb In xlApp.CommandBars
If ocb.Name <> "Worksheet Menu Bar" And _
ocb.Visible Then _
ocb.Visible = False
Next ocb
Application.CommandBars("Worksheet Menu Bar").Enabled = False
 
Thanks but:


The user that opens excel from the access-interface must not have the
menubar, that works OK.
But other users who opens excel directly on the server must have the
menubar.
Now the MenuBar stays NOT enabled.

How do i enable the 'Worksheet Menu Bar' on closing excel.

Filip
 
I would have thought that was obvious

Application.CommandBars("Worksheet Menu Bar").Enabled = True
 

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