ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prob: Custom CommandBars and .xls Files Being Re-Opened (https://www.excelbanter.com/excel-programming/313998-prob-custom-commandbars-xls-files-being-re-opened.html)

James Cox[_2_]

Prob: Custom CommandBars and .xls Files Being Re-Opened
 
I've created a personal.xls that has on a worksheet the definitions of
custom commandbars. Code in the personal.xls is called from a workbook_open
event in ThisWorkbook. This code activates the worksheet and steps down
through the cells, reading and building the custom command bars.

If I open Excel directly (not double-clicking on a .xls file), the custom
commandbars are displayed fine.

If I double-click on an Excel workbook that does not contain macros, the
custom commandbars are displayed and the double-clicked workbook opens
normally.

However, if I double-click on an Excel workbook that contains macros, the
custom commadbars are displayed and Excel shows the standard "this workbook
has macros - do you want to enable them" message box. When I click on the
"enable macros" button, the workbook with macros opens, the mouse pointer
goes to the hourglass for a few seconds and then a message box pops up with
the text:

(.xls filename) is already open. Reopening it will cause changes you
made to be discarded. Do you want to reopen (.xls filename)?

where (.xls filename) in the above is the name of the .xls file that has
macros.

Clicking either the Yes or No button on that message box gives me access to
the workbook with macros, but I can't figure out why it's trying to reopen
the workbook.

For what it's worth, choosing the "Disable Macros" button on the first
warning (the one about the .xls file having macros) gives the same results.

Any help would be most appreciated! I've spent way too long on getting
custom, on-the-fly commandbars this close to working, but my .xlb file had
grown to 1.8 MB!

James Cox




All times are GMT +1. The time now is 04:19 AM.

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