![]() |
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. |
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. |
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. |
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. . |
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. . |
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. . . |
All times are GMT +1. The time now is 03:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com