LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default custom menu cross contamination between open workbooks.

I have several Excel workbooks that have custome menus. The workbooks
are set up so that the menus are generated when the workbooks are opened
and the menus are eliminated with the workbooks are closed. However, if
two workbooks are open at the same time, both sets of menus show on both
workbooks.

Some of the people that work for me end up running WorkbookA macros
(from menu) on WorkbookB, and vice versa. Would adding a test at the
beginning of each WorkbookA macro to make sure the active workbook is
WorkbookA prevent errors? If a Workbook is open but in a background
window or miniturized, is it still an "active workbook?"

Is there any way to prevent workbookA's menus from being visible in
WorkbookB if both are OPEN simultaneously?

The menu generation program was generously created by someone other than
myself, perhaps Joseph Rubin. I'm very much indebted to whoever wrote
the code, because it has made my workbooks a lot easier to use and
modify. The beginning of the code looks like:

Sub CreateMenu()
Dim MenuGen As Worksheet
Dim MenuObject As CommandBarPopup
Dim MenuItem As Object
Dim SubMenuItem As CommandBarButton
Dim Row As Integer
Dim MenuLevel, nextlevel, PositionOrMacro, Caption, Divider, FaceId

' Initialize the row counter
Row = 2
Do Until IsEmpty(MenuGen.Cells(Row, 1))
With MenuGen
MenuLevel = .Cells(Row, 1)
Caption = .Cells(Row, 2)
PositionOrMacro = .Cells(Row, 3)
Divider = .Cells(Row, 4)
FaceId = .Cells(Row, 5)
nextlevel = .Cells(Row + 1, 1)
End With

Thanks WindsurferLA
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross referencing two workbooks? Jeffrey[_2_] Excel Worksheet Functions 3 January 19th 09 05:40 PM
calculating the probablity of HBsAg contamination jimbo Excel Worksheet Functions 0 October 7th 07 11:49 AM
CROSS REFERENCE BETWEEN WORKBOOKs Chuckles123[_74_] Excel Programming 3 November 25th 04 12:09 AM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM
Autoload custom menu on Workbook Open Johann[_2_] Excel Programming 1 December 30th 03 07:55 AM


All times are GMT +1. The time now is 08:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"