Disabling Excel functions

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi,

I'm creating an excel object in access and opening a
workbook. This is fine - however I want to disable SAVEAS
and OPEN. I don't really want to change the visible
property of commandbars as this changes the users excel
and requires more code to reset things back to how they
were. I want something that temporarily disables these
functions no matter how the are accessed - i.e. File tool
bar, buttons or keyboard shortcuts.

Any ideas??

Thanks
Paul
 
Use the Workbook_BeforeSave event to disable SaveAs:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Cancel = SaveAsUI
End Sub

Disabling Open is a bit more complicated. You would have to trap the
WorkbookOpen event of the Application object and then immediately close any
opened workbook.

Of course you could disable existing menu items, toolbars and keyboard
shortcuts individually but then you would have the same problem as disabling
the entire menus and toolbars.
 

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