Excel 2007, excel 2003 custom toolbar help

smiler44

Registered User.
Local time
Today, 04:29
Joined
Jul 15, 2008
Messages
671
my excel 2003 custom toolbar appears in excel 2007 in the addin's tab.

I press a button, say button1 and a macro runs.
At the end of the macro I have a line of code,
commandbars("book1").controls("button1").enabled = false
My button greys out, just as it should.
I save my work and shut down excel 2007. When I open it up again, button1 has become active again. It is as if 2007 is remembering the state of the buttons when the workbook was first opened after converting it from 2003 to 2007.

How do I keep the button disabled until I use the line of code
commandbars("book1").controls("button1").enabled = true

if users can access a button out of turn becasue 2007 has decided to make them active it could really have serious consequences to the workbook.

smiler44
 
I have cracked the problem. It is a quirk of Excel 2007 not liking the code of Excel 2003.
The problem was the code in the Thisworkbook, workbook, beforeclose area. I was using toolbars("toolbar_name").delete this works in Excel 2003 but have had to change it to
toolbars("toolbar_name").visible.false. initial testing seems to have the same effect in that the toolbar is not accessible by other workbooks and my command buttons hold the enabled/disabled state that they are in when the wookbook is closed.

smiler44
 

Users who are viewing this thread

Back
Top Bottom