Copy button caption

  • Thread starter Thread starter John Pierce
  • Start date Start date
J

John Pierce

While using another data base program, I often toggle over to an excel
spreadsheet that has frequently used blurbs in separate cells. I would
then click on the appropriate cell, press Ctrl+C to copy the contents,
and toggle back to my database and paste the blurb. I figured out that
I could save a little effort by making a button with a macro that
copies the blurb with one click, but it is quite elaborate to set up:
type the blurb, name the range, create a macro that copies the range,
create the button, attach the macro. Then I thought "why not just have
buttons whose labels (captions) are the blurbs?!" So, can I create a
forms button whose "text" caption can be copied when clicked, and, if
so, how? Or, as I am thinking, will it need to be a Command button
with caption property - click the button and copy the caption.
 
hi,
you copy stuff in cells. a command button is an object with properties so
you do that a tad different.
Private Sub cb1_Click()
Dim c As String
c = cb1.Caption
Range("A1").Value = c
End Sub
maybe this will get you pointed in the right direction,
regards
FSt1
 
hi,
you copy stuff in cells. a command button is an object with properties so
you do that a tad different.
Private Sub cb1_Click()
Dim c As String
c = cb1.Caption
Range("A1").Value = c
End Sub
maybe this will get you pointed in the right direction,
regards
FSt1
Okay, I added Range("A1").copy and that works.
Private Sub cb1_Click()
Dim c As String
c = cb1.Caption
Range("A1").Value = c
Range("A1").copy
End Sub
But, I can't help thinking there must be a more elegant way of getting
the caption directly to the clipboard.
 
Back
Top