Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default VBA:programmatically invoking menu items from Excel Worksheet



"Bob Phillips" wrote:

New and Exciting ... what?

--
---
HTH


Sorry - just an abbreviated cross reference to a comment made by JLatham
which was

" This might help with the hunt for the control's ID? Gives a list, although
interpreting the output list may be an interesting experiment in the chapter
on New and Exciting Ways to Lock Up Excel. "


Actually it all went without a hitch.

Thanks for your advice and help

Morse


Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"morse100" wrote in message
...


"JLatham" wrote:

This might help with the hunt for the control's ID? Gives a list,
although
interpreting the output list may be an interesting experiment in the
chapter
on New and Exciting Ways to Lock Up Excel.

Sub ControlBarsInfo()
'potential properties of CommandBar objects:
' .AdaptiveMenu
' .Application
' .BuiltIn
' .Controls
' .Creator
' .Height
' .Index
' .Left
' .Name
' .NameLocal
' .Parent
' .Position
' .RowIndex
' .Top
' .Type
' .Visible
' .Width
'
'potential methods of them
' .Delete
' .FindControl
' .Reset
' .ShowPopUp
'

Dim anyCB As CommandBar
Dim anyControl As Object
Worksheets("Sheet1").Activate
Range("A1").Select
For Each anyCB In CommandBars
ActiveCell = anyCB.Name
ActiveCell.Offset(0, 1) = anyCB.ID
If anyCB.Controls.Count 0 Then
ActiveCell.Offset(0, 3) = "Has Controls"
End If
On Error Resume Next ' not all report a parent
ActiveCell.Offset(0, 2) = anyCB.Parent
ActiveCell.Offset(1, 0).Activate

Next
End Sub


"Bob Phillips" wrote:

You need to get the controls id, and then execute it like so

Application.VBE.CommandBars.FindControl(ID:=ctl_id ).Execute

Sheet delete is 847.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"morse100" wrote in message
...
I would like to to be able invoke specified menu items from the
standard
Excel WorkSheet menu bar from within VBA subroutines and functions
(do
***not*** need to change the resulting behaviour in any way
whatsoever).

For example

Edit | Delete Sheet

But I have absolutely no idea how to access the equivalent OnAction
macro,
or indeed to discover its name.


Any and all help will be much appreciated

many thanks

morse



Hi,

many thanks. I am about to 'write' a contribution to the "New and Exciting
......".

Best wishes


Morse




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VBA:programmatically invoking menu items from Excel Worksheet

LOL! Thanks for telling me.



"morse100" wrote in message
...


"Bob Phillips" wrote:

New and Exciting ... what?

--
---
HTH


Sorry - just an abbreviated cross reference to a comment made by JLatham
which was

" This might help with the hunt for the control's ID? Gives a list,
although
interpreting the output list may be an interesting experiment in the
chapter
on New and Exciting Ways to Lock Up Excel. "


Actually it all went without a hitch.

Thanks for your advice and help

Morse


Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



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
Excel 97 menu items Oldjay Excel Discussion (Misc queries) 4 March 5th 08 11:48 PM
2 adobe menu items in Excel Appie Excel Discussion (Misc queries) 0 May 18th 06 08:33 AM
how to create sub menu items in Excel? Joshua Excel Programming 1 August 12th 05 02:47 PM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
New Menu on Worksheet & Chart Menu Bars Juan[_3_] Excel Programming 2 May 21st 04 11:46 PM


All times are GMT +1. The time now is 09:14 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"