#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Command Bar

Is there a way to set a command bar's "OnAction" property
to place the commandbar's caption in a cell?

I need a hint.
What I'm trying to do is make a right-click button that
lists choices for a user to place in the target cell. The
amount of choices will vary. I've got the commandbar
code down but was wondering if there was a way to call a
macro that looks at the caption of the selected control.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Command Bar

With worksheets("Sheet1")
Range("A1").Value = _
Application.CommandBars.ActionControl.Caption
End With

--
Regards,
Tom Ogilvy

DEFJ wrote in message
...
Is there a way to set a command bar's "OnAction" property
to place the commandbar's caption in a cell?

I need a hint.
What I'm trying to do is make a right-click button that
lists choices for a user to place in the target cell. The
amount of choices will vary. I've got the commandbar
code down but was wondering if there was a way to call a
macro that looks at the caption of the selected control.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Command Bar

Point the OnAction property to a macro, and in the macro you can get the
caption with

ActiveCell.Value = Application.CommandBars.ActionControl.Caption


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"DEFJ" wrote in message
...
Is there a way to set a command bar's "OnAction" property
to place the commandbar's caption in a cell?

I need a hint.
What I'm trying to do is make a right-click button that
lists choices for a user to place in the target cell. The
amount of choices will vary. I've got the commandbar
code down but was wondering if there was a way to call a
macro that looks at the caption of the selected control.



  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Command Bar

Thanks, it works well

I only want the cell to have the first couple of
characters from the selected control. Is there a way to
truncate ActiveControl.caption? I tried setting it to a
string variable but got a data mismatch error.

-----Original Message-----
Point the OnAction property to a macro, and in the macro

you can get the
caption with

ActiveCell.Value =

Application.CommandBars.ActionControl.Caption


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"DEFJ" wrote in

message
...
Is there a way to set a command bar's "OnAction"

property
to place the commandbar's caption in a cell?

I need a hint.
What I'm trying to do is make a right-click button that
lists choices for a user to place in the target cell.

The
amount of choices will vary. I've got the commandbar
code down but was wondering if there was a way to call a
macro that looks at the caption of the selected control.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Command Bar

Use the LEFT method on it.

ActiveCell.Value = Left(Application.CommandBars.ActionControl.Caption ,
2)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

wrote in message
...
Thanks, it works well

I only want the cell to have the first couple of
characters from the selected control. Is there a way to
truncate ActiveControl.caption? I tried setting it to a
string variable but got a data mismatch error.

-----Original Message-----
Point the OnAction property to a macro, and in the macro

you can get the
caption with

ActiveCell.Value =

Application.CommandBars.ActionControl.Caption


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"DEFJ" wrote in

message
...
Is there a way to set a command bar's "OnAction"

property
to place the commandbar's caption in a cell?

I need a hint.
What I'm trying to do is make a right-click button that
lists choices for a user to place in the target cell.

The
amount of choices will vary. I've got the commandbar
code down but was wondering if there was a way to call a
macro that looks at the caption of the selected control.



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Command Bar

Thanks- I really appreciate your help
-----Original Message-----
Use the LEFT method on it.

ActiveCell.Value = Left

(Application.CommandBars.ActionControl.Caption,
2)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

wrote in message
...
Thanks, it works well

I only want the cell to have the first couple of
characters from the selected control. Is there a way to
truncate ActiveControl.caption? I tried setting it to a
string variable but got a data mismatch error.

-----Original Message-----
Point the OnAction property to a macro, and in the

macro
you can get the
caption with

ActiveCell.Value =

Application.CommandBars.ActionControl.Caption


--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"DEFJ" wrote in

message
...
Is there a way to set a command bar's "OnAction"

property
to place the commandbar's caption in a cell?

I need a hint.
What I'm trying to do is make a right-click button

that
lists choices for a user to place in the target cell.

The
amount of choices will vary. I've got the

commandbar
code down but was wondering if there was a way to

call a
macro that looks at the caption of the selected

control.


.



.

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
One command in one cell initiating another command in another cel. Chas52 Excel Worksheet Functions 3 November 7th 09 06:57 PM
command code ( GOTO command) in formula calan New Users to Excel 1 June 11th 09 09:44 AM
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM


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