#1   Report Post  
GregR
 
Posts: n/a
Default Cell Menu

I have the following code which adds the macros to the cell menu. How do I
begin a group for the array or assign the array to a submenu. TIA

Greg


  #2   Report Post  
GregR
 
Posts: n/a
Default

Might be nice if I added the code:
Sub AddtoCellMenuAbs()

Dim iCtr As Long
Dim myMacros As Variant
Dim myCaptions As Variant

Dim cb As CommandBar
Set cb = Application.CommandBars("Cell")

myMacros = Array("Absolute.Absolute", "Relative", "AbsoluteRow",
"AbsoluteCol")
myCaptions = Array("Absolute", "Relative", "Absolute Row", "Absolute
Col")

With cb.Controls

For iCtr = LBound(myMacros) To UBound(myMacros)
With .Add(Type:=msoControlButton, temporary:=True)
.Caption = myCaptions(iCtr)
.OnAction = ThisWorkbook.Name & "!" & myMacros(iCtr)
' .FaceId = 103
' .BeginGroup = True
End With
Next iCtr
End With
'in your workbook_open/auto_open code, you can just have a
'Call AddToCellMenu
End Sub

Greg
"GregR" wrote in message
...
I have the following code which adds the macros to the cell menu. How do I
begin a group for the array or assign the array to a submenu. TIA

Greg




  #3   Report Post  
Norman Jones
 
Posts: n/a
Default

Hi GregR,

One way:

Sub AddtoCellMenuAbs()

Dim iCtr As Long
Dim myMacros As Variant
Dim myCaptions As Variant
Dim blBeginGroup As Boolean

Dim cb As CommandBar
Set cb = Application.CommandBars("Cell")

myMacros = Array("Absolute.Absolute", "Relative", _
"AbsoluteRow", "AbsoluteCol")
myCaptions = Array("Absolute", "Relative", _
"Absolute Row", "AbsoluteCol ")

With cb.Controls
For iCtr = LBound(myMacros) To UBound(myMacros)
With .Add(Type:=msoControlButton, temporary:=True)
.Caption = myCaptions(iCtr)
.OnAction = ThisWorkbook.Name & "!" & myMacros(iCtr)
.FaceId = 103
If Not blBeginGroup Then
.BeginGroup = True
blBeginGroup = True
End If
End With
Next iCtr
End With
'in your workbook_open/auto_open code, you can just have a
'Call AddToCellMenu
End Sub


---
Regards,
Norman



"GregR" wrote in message
...
Might be nice if I added the code:
Sub AddtoCellMenuAbs()

Dim iCtr As Long
Dim myMacros As Variant
Dim myCaptions As Variant

Dim cb As CommandBar
Set cb = Application.CommandBars("Cell")

myMacros = Array("Absolute.Absolute", "Relative", "AbsoluteRow",
"AbsoluteCol")
myCaptions = Array("Absolute", "Relative", "Absolute Row", "Absolute
Col")

With cb.Controls

For iCtr = LBound(myMacros) To UBound(myMacros)
With .Add(Type:=msoControlButton, temporary:=True)
.Caption = myCaptions(iCtr)
.OnAction = ThisWorkbook.Name & "!" & myMacros(iCtr)
' .FaceId = 103
' .BeginGroup = True
End With
Next iCtr
End With
'in your workbook_open/auto_open code, you can just have a
'Call AddToCellMenu
End Sub

Greg
"GregR" wrote in message
...
I have the following code which adds the macros to the cell menu. How do
I
begin a group for the array or assign the array to a submenu. TIA

Greg






  #4   Report Post  
GregR
 
Posts: n/a
Default

Norman, thank you very much.

Greg
"Norman Jones" wrote in message
...
Hi GregR,

One way:

Sub AddtoCellMenuAbs()

Dim iCtr As Long
Dim myMacros As Variant
Dim myCaptions As Variant
Dim blBeginGroup As Boolean

Dim cb As CommandBar
Set cb = Application.CommandBars("Cell")

myMacros = Array("Absolute.Absolute", "Relative", _
"AbsoluteRow", "AbsoluteCol")
myCaptions = Array("Absolute", "Relative", _
"Absolute Row", "AbsoluteCol ")

With cb.Controls
For iCtr = LBound(myMacros) To UBound(myMacros)
With .Add(Type:=msoControlButton, temporary:=True)
.Caption = myCaptions(iCtr)
.OnAction = ThisWorkbook.Name & "!" & myMacros(iCtr)
.FaceId = 103
If Not blBeginGroup Then
.BeginGroup = True
blBeginGroup = True
End If
End With
Next iCtr
End With
'in your workbook_open/auto_open code, you can just have a
'Call AddToCellMenu
End Sub


---
Regards,
Norman



"GregR" wrote in message
...
Might be nice if I added the code:
Sub AddtoCellMenuAbs()

Dim iCtr As Long
Dim myMacros As Variant
Dim myCaptions As Variant

Dim cb As CommandBar
Set cb = Application.CommandBars("Cell")

myMacros = Array("Absolute.Absolute", "Relative", "AbsoluteRow",
"AbsoluteCol")
myCaptions = Array("Absolute", "Relative", "Absolute Row", "Absolute
Col")

With cb.Controls

For iCtr = LBound(myMacros) To UBound(myMacros)
With .Add(Type:=msoControlButton, temporary:=True)
.Caption = myCaptions(iCtr)
.OnAction = ThisWorkbook.Name & "!" & myMacros(iCtr)
' .FaceId = 103
' .BeginGroup = True
End With
Next iCtr
End With
'in your workbook_open/auto_open code, you can just have a
'Call AddToCellMenu
End Sub

Greg
"GregR" wrote in message
...
I have the following code which adds the macros to the cell menu. How

do
I
begin a group for the array or assign the array to a submenu. TIA

Greg








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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
Delete Cell Value Based on Another Cell T or F DocuMike Excel Discussion (Misc queries) 3 January 5th 05 08:46 PM
How do I link many cells to one particular cell? fish@divi Excel Discussion (Misc queries) 2 January 4th 05 11:00 PM
Display actual contents of cell xmasbob Excel Discussion (Misc queries) 1 December 6th 04 05:09 PM


All times are GMT +1. The time now is 06:17 PM.

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"