Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How can I check if a pop-up menu exists...

Hi All,

Help with another (probably easy for you all) question. I use the code
below to add a pop-up menu that runs a macro.

On Error Resume Next
With Application
.CommandBars("Cell").Controls("GICAP Formatter").Delete
Set cBut = .CommandBars("Cell").Controls.Add(Temporary:=False )
End With

With cBut
.Caption = "GICAP Formatter"
.Style = msoButtonCaption
.OnAction = "FormatIssuesWorkSheet"
End With

What I need to know is how to check if the pop-up menu exists the next
time the workbook is opened? The "on error" process doesn't work for me
in this case because I need this check in the middle of a subroutine.
However, I continue in the subroutine whether it exists or not.

Can someone help?

Thanks,
Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default How can I check if a pop-up menu exists...



What I need to know is how to check if the pop-up menu exists the next
time the workbook is opened? The "on error" process doesn't work for me
in this case because I need this check in the middle of a subroutine.
However, I continue in the subroutine whether it exists or not.

Can someone help?

Thanks,
Chris


This works for me Phillip London UK

Dim x As Long
For x = 1 To Application.CommandBars("Cell").Controls.Count
If Application.CommandBars("Cell").Controls(x).Captio n = "GICAP
Formatter" Then
MsgBox "It Exists"
End If
Next

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How can I check if a pop-up menu exists...

Chris,
Not sure what you are after, but you can change the error trapping employed
in a routine:

Private Sub CommandButton1_Click()
Dim i

'Activate the error handler
On Error GoTo Handler
'Some code
i = 1 / 0

'Change to Resume Next
On Error Resume Next
'Some code to skip over error
i = 1 / 0

'No error handling
On Error GoTo 0
'More code, although this will stop execution
i = 1 / 0

'Activate the error handler, again
On Error GoTo Handler
i = 1 / 0

Exit Sub
Handler:
'Deal with the error
'Here we just resume next statement
Resume Next
End Sub

NickHK

"Lakehills" wrote in message
oups.com...
Hi All,

Help with another (probably easy for you all) question. I use the code
below to add a pop-up menu that runs a macro.

On Error Resume Next
With Application
.CommandBars("Cell").Controls("GICAP Formatter").Delete
Set cBut = .CommandBars("Cell").Controls.Add(Temporary:=False )
End With

With cBut
.Caption = "GICAP Formatter"
.Style = msoButtonCaption
.OnAction = "FormatIssuesWorkSheet"
End With

What I need to know is how to check if the pop-up menu exists the next
time the workbook is opened? The "on error" process doesn't work for me
in this case because I need this check in the middle of a subroutine.
However, I continue in the subroutine whether it exists or not.

Can someone help?

Thanks,
Chris



Reply
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
Check to see if a value exists in a list? Pradhan Excel Worksheet Functions 6 April 2nd 23 06:35 PM
Check if file exists Jon Excel Discussion (Misc queries) 14 October 4th 07 04:57 PM
HOW TO: Check if a picture exists? Kevin McCartney Excel Programming 5 August 23rd 06 03:41 PM
Check to see if cell value exists Mark Excel Programming 3 November 5th 03 03:20 PM
determinate if pop up menu exists GUS Excel Programming 1 November 4th 03 08:11 PM


All times are GMT +1. The time now is 01:07 PM.

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

About Us

"It's about Microsoft Excel"