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>