![]() |
Copy button caption
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. |
Copy button 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 "John Pierce" wrote: 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. |
Copy button caption
On Aug 10, 1:08 pm, FSt1 wrote:
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 "John Pierce" wrote: 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.- Hide quoted text - 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. |
All times are GMT +1. The time now is 04:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com