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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top