Testing to see if a Workbook menu item exists

T

Todd Huttenstine

Hey guys

What is the code to test to see if the workbook menu item "Import Data"
exists? If it exists, it will be located to the right of the menu item
"Help".

Thanx

Todd Huttenstine
 
H

Harald Staff

Hi Todd

You seem to be busy these days :)

Function GotMenu(strCapt As String) As Boolean
On Error Resume Next
GotMenu = Len(Application.CommandBars(1).Controls(strCapt).Caption)
End Function

Sub test()
MsgBox GotMenu("File")
MsgBox GotMenu("Import Data")
End Sub
 
T

Todd Huttenstine

ha yeah I am busy. THanx for your help.

Todd
Harald Staff said:
Hi Todd

You seem to be busy these days :)

Function GotMenu(strCapt As String) As Boolean
On Error Resume Next
GotMenu = Len(Application.CommandBars(1).Controls(strCapt).Caption)
End Function

Sub test()
MsgBox GotMenu("File")
MsgBox GotMenu("Import Data")
End Sub
 
Top