LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 866
Default Right Click Dropdown

I run several reports with ledger data and journal data. I added a right
click drop down allowing a user to look up journals from the ledger data.
All works well except for .... I added a 'before close' piece of code to
delete the drop down items - don't wish them to be there if the file is not
in use. I assumed only one file would be open at a time - wrong. If a
second file is opened and either the first or second is closed, the menu
items go away. Is there an easy way to interrogate the open files and leave
the drop down if a file that needs it is open?

Module Code
Sub see_journals()
a = ActiveCell.Column
X = ActiveCell.Value
If a < 4 Or X = "" Then
MsgBox "Please place your cursor on an account number."
Exit Sub
End If
Worksheets("Journal Details").Select
Range("Journal").Select
Selection.AutoFilter Field:=5, Criteria1:=X
End Sub

Sub NewItem()
On Error GoTo ONE
If CommandBars("Cell").Controls("See Journals").Visible Then
Exit Sub
End If
ONE:
Dim ThisItem As Object
Set ThisItem = CommandBars("Cell").Controls.Add
With ThisItem
..Caption = "See Journals"
..OnAction = "See_Journals"
..BeginGroup = True
End With
End Sub

Sub RidIt()
On Error Resume Next
CommandBars("Cell").Controls("See Journals").Delete
End Sub

ThisWorkbook Code
Private Sub Workbook_BeforeClose(Cancel As Boolean)
RidIt
End Sub

 
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
Dropdown box display only data dependent on another dropdown box? Chris Excel Worksheet Functions 8 August 5th 08 05:01 PM
Can't click on dropdown menu in excel, but others can. Help! ivan Excel Discussion (Misc queries) 1 April 10th 08 06:57 PM
Disabling click and right-click on the Picture I inserted in an Excel document [email protected] Excel Worksheet Functions 1 June 2nd 06 09:13 PM
offer dropdown options based on another dropdown Conor Excel Discussion (Misc queries) 2 January 13th 06 04:28 PM
Click on graph bar to execute a double-click in a pivot table cell [email protected] Charts and Charting in Excel 4 August 3rd 05 01:37 AM


All times are GMT +1. The time now is 02:23 AM.

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"