Command Bar

  • Thread starter Thread starter DEFJ
  • Start date Start date
D

DEFJ

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.
 
With worksheets("Sheet1")
Range("A1").Value = _
Application.CommandBars.ActionControl.Caption
End With
 
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)
 
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.
 
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)
 
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)




.
 
Back
Top