Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Menu Help - cell reference

Have a large workbook and placing a menu to manuever around. I want to base
the menu list off a cell range. Names may change. I cant figure this out

Dim myMnu As Object

Set myMnu = CommandBars("Worksheet menu bar").Controls. _
Add(Type:=msoControlPopup, befo=2)

With myMnu
.caption = "&Volunteers"
.Controls.Add(Type:=msoControlButton, befo=1).caption =
Sheet1.Range("m21")
..Controls(Sheet1.Range("m21")).OnAction = "Vol1" (blows out here)
End with

The values match. I have created menus for successfully with the same code
with the exception of using the range ie caption ="text" ....
..controls("text).OnAction etc
Where am I going wrong. MUCH thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Menu Help - cell reference

This worked for me:

.Controls(Sheet1.Range("m21").Text).OnAction = "Vol1"

Unless you need the object variables, though, my preference would be to
use something like this:

With CommandBars("Worksheet menu bar").Controls.Add( _
Type:=msoControlPopup, befo=2)
.Caption = "&Volunteers"
With .Controls.Add(Type:=msoControlButton, befo=1)
.Caption = Sheet1.Range("m21").Text
.OnAction = "Vol1"
End With
End With



In article ,
Dan wrote:

Have a large workbook and placing a menu to manuever around. I want to base
the menu list off a cell range. Names may change. I cant figure this out

Dim myMnu As Object

Set myMnu = CommandBars("Worksheet menu bar").Controls. _
Add(Type:=msoControlPopup, befo=2)

With myMnu
.caption = "&Volunteers"
.Controls.Add(Type:=msoControlButton, befo=1).caption =
Sheet1.Range("m21")
.Controls(Sheet1.Range("m21")).OnAction = "Vol1" (blows out here)
End with

The values match. I have created menus for successfully with the same code
with the exception of using the range ie caption ="text" ....
.controls("text).OnAction etc
Where am I going wrong. MUCH thanks in advance

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
Drop dwn menu. Formula to count selection frm menu in anoth cell? ggoldber Excel Worksheet Functions 1 June 4th 08 02:21 PM
Reference Dropdown Menu Items in Macro FuadsCurse Excel Programming 1 May 3rd 05 03:24 PM
How Do I Reference Individual Dropdown Menu Items in VBA? FuadsCurse Excel Programming 3 May 3rd 05 02:41 PM
How to reference # of copies in print menu? Brandon Klassen Excel Programming 0 August 23rd 04 11:25 PM
relative reference button on end macro menu RobC[_2_] Excel Programming 4 March 2nd 04 09:24 PM


All times are GMT +1. The time now is 06:42 AM.

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"