ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Open option in Excel Report from VB (https://www.excelbanter.com/excel-programming/343443-disable-open-option-excel-report-vbulletin.html)

oursmp[_2_]

Disable Open option in Excel Report from VB
 

Hi,

How to disable open option when I right click on the excel desktop.

By using the following code, I have successfully achieved the disabling
of open option from Menu bar and Toolbar.

Now I need to disable the same in the Excel desktop’s right Click.

Set mFileMenu = CommandBars.FindControl(ID:=30002) ' File Menu

If mFileMenu Is Nothing Then Exit Sub

For Each mOpenMenu In mFileMenu.Controls

If mOpenMenu.ID = 23 Then mOpenMenu.Enabled = False

Next mOpenMenu

Set mOpenMenu = Nothing

Set mFileMenu = Nothing



Set mOpenMenuToolBar = CommandBars.FindControl(ID:=23) ' Tool Bar

If mOpenMenuToolBar Is Nothing Then Exit Sub

mOpenMenuToolBar.Enabled = False

Set mOpenMenuToolBar = Nothing



We cannot lock the excel file completely, as we need some options like
Print, Save As etc.

Thanks in advance
ourspt


--
oursmp
------------------------------------------------------------------------
oursmp's Profile: http://www.excelforum.com/member.php...o&userid=22443
View this thread: http://www.excelforum.com/showthread...hreadid=478191



All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com