View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wesbird wesbird is offline
external usenet poster
 
Posts: 6
Default Excel Application Level Global Variable

Hi,
I have another question:
I create my customzation pull down menu. when my excel Tool.xls open, it
will add pull down menu MyTool to the menu bar. when Tool.xls close, I will
remove it from menu bar. I did this in the code below:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
DeletePBRISMenu
End Sub

Private Sub Workbook_Open()
CreatePBRISMenu
End Sub

Now my problem is, if there are multiple Tool.xls(it could be copied and
renamed) opened, when first Tool.xls close, my pull down menu get removed. I
am thinking to add a global variable (MenuCount) to count the number of
opened tool.xls file. when a tool.xls opend, MenuCount++; a tool.xls closed,
MenuCount--. when MenuCount = 0, remove my pull down menu.
but it does not work. the reason I think is, my global variable is
document level, not application level. Then how I can set a application level
global variable? Or is there any other solution I should think about?
Thank you in advance




Wes