Using Active X buttons to copy data to clipboard

cr130

New Member
Joined
Oct 3, 2023
Messages
15
Office Version
  1. 2016
Platform
  1. Windows
Hello All,

Today I am trying to attach a VBA Code to a Active X button that will copy a certain text line to the clipboard. I know how to copy a cell with an active x button but wanted to do it without referencing a cell.
 
In the macro I put a comment:

"'Example to paste on the active sheet"

It is just an example to paste what you put in memory.

To make it work, just delete this line:

ActiveSheet.Paste

:cool:


VBA Code:
Sub put_clipboard_2()
  Dim obj As Object
 
  Set obj = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
  obj.SetText "copy a certain text line to the clipboard"
  obj.PutInClipboard
End Sub
Yeah, i did try that but it didnt do anything. i didnt even get an error. i am sure its just user error. i am still learning all this stuff. i appreciate your help Dante.
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
i did try that but it didnt do anything.



In the previous post you commented that it is pasting you on the page, it means that the text is in memory.
it just paste into the cell i am highlighted in excel


It means it is working, the text is on the clipboard, I don't understand what you mean by " it didnt do anything"
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top