Clipboard

smithar

New Member
Joined
Oct 29, 2002
Messages
6
I am working on a product that has been developed using VBA. The requirement is that I need to use the Excel ClipBoard to store the formats of the used range in excel. And re-apply it on the Excel when required using a toolbar button.

I need to use the full functionality of the clipboard using VBA, i.e I need to store/retrieve 12 items in the clipboard (which is the max it can store for Office 2000)

Any Solutions?

Regards
Smitha
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
On 2002-11-03 23:36, smithar wrote:
I am working on a product that has been developed using VBA. The requirement is that I need to use the Excel ClipBoard to store the formats of the used range in excel. And re-apply it on the Excel when required using a toolbar button.

I need to use the full functionality of the clipboard using VBA, i.e I need to store/retrieve 12 items in the clipboard (which is the max it can store for Office 2000)

Any Solutions?

Regards
Smitha

The Office clipboard is not supported well
in VBA, in fact there is no Clipboard object
or none that I could find in the Object browser.....so your only way round is to use the clipboard commandbar and it's controls, of
which there are Basically 4 + 12;

&Copy
Paste A&ll
Ite&ms
C&lear Clipboard

The Empty ones corelate to the Item numbers
for the storage of the copied items = 12

Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty

I got these via

</pre>
Sub Tester()
Dim cb As CommandBar
Dim x As Integer

Set cb = Application.CommandBars("Clipboard")

'// after 4 = each item
On Error Resume Next
For x = 1 To 20 ' enought ?
Cells(x, 1) = cb.Controls(x).Caption
Next

End Sub
</pre>


So in order to use this you can use the following.....

<pre/>
Sub TesterII()
Dim iClipBItem As Integer
'// Where iClipBItem is the 1st Item copied
'// that goes to => item5
'// Don't forget each item copied goes to the
'// next avail Empty Item number

CommandBars("Clipboard").Controls(iClipBItem).Execute

End Sub
</pre>
 
Upvote 0
Thanks Ivan, I did a bit of experimenting with the command bar. Doesnt't look like a very good solution . In fact microsoft itself says that the clipboard is not managed in VBA.

I guess I would rather have an array which can hold the values rather than use the clipboard.

Thanks anyway
 
Upvote 0

Forum statistics

Threads
1,214,874
Messages
6,122,034
Members
449,061
Latest member
TheRealJoaquin

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