Thread: no menu's
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Philip Philip is offline
external usenet poster
 
Posts: 156
Default no menu's

Hi,

To make all other workbooks open in a separate Excel window, you need to set
the Application property 'IgnorRemoterequests' to True when your special
workbook is opened, and false when it is closed (this is the same as checking
the box in the Options dialog for 'Ignore Remote Applications')

To disable all commandbars, you loop through the Commandbars collection,
setting each members 'Enabled' property to False, and reset them when the
workbook is closed.

So, in the VB Editor of Excel, in the Workbook_open event procedure of the
ThisWorkbook class module, you would put code like this:

CODE SAMPLE

dim xBar as commandbar

' DISABLE ALL COMMANDBARS, TGOOLBARS, MENUS !!!
for each xbar in commandbars ' includes menus, AND commandbars!
xbar.enabled=false
next

application.ignoreremoterequests=true
<<< END <<<

and in the workbook_close event handler of the same module, you would have
code like this:

SAMPLE CODE

dim xBar as commandbar

' DISABLE ALL COMMANDBARS, TGOOLBARS, MENUS !!!
for each xbar in commandbars ' includes menus, AND commandbars!
xbar.enabled=true
next

application.ignoreremoterequests=false

<<< END <<<

BTW, this also prevents anyone using the Toolbar List menu...but anyone can
double-click on the area at the top of the Excel window, and they get the
Customize Commandbars dialog, which allows them to add their own commandbars
and menus...

In Office XP (or is it 2002/2003 ?), you can disable this feature by setting
the "application.commandbars.disablecustomize" property to true, and reset it
when the workbook is closed.

BTW:
If Excel crashes, then the Workbook_Close event will not fire, so next time
you open Excel it may still have all the menus and commandbars disabled, and
the only way to reset them is using the code above (close event).

Also, unless you prevent people having access to the VB Editor and the
workbooks VB Project, they can easily open up the VB Editor (ALT-F11, or
ALT-F8 in MS Excel) and run some code to reset the menus - to get around that
you have to disable keystrokes using the OnKey property of the Application
object (yes, reset the defaults when the workbook is closed)

If you leave the property 'ignoreremoterequests' set to false, then Windows
will give you an error when you double-click on a file in Explorer to open
it, or when you double-click an attachment in MS Outlook, so be aware that
this property needs to be reset when the workbook is closed, or, next time
you open Excel, on the Tools menu, Options dialog, you can uncheck the box
that says 'Ignore remote applications'

HTH

Philip

"ceemo" wrote:


Hi,

I would like to set my excel workbook up so that i dont see any menu's
rows or anything. This is to give it the look like it is a non excel
application. I would need it to only be aplicable to this workbook and
so that any other excel books there were opened would beopened in a
separate regular book.


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=396411