Example Data Objects (and Clipboards) Use Clipboard to manipulate Excel ranges through string manipulation.
Data Objects and Clipboards
It cannot be easily explained what a data object is. It could be considered to be an abortion that didn’t die. It is difficult to discuss the DataObject without discussing the clipboards
Clipboards and the DataObject
The last title was Data Objects and Clipboards and this one is Clipboards and the DataObject: It is a spaghetti of things that anyone has long since given up trying to straighten out or figure out.
When you play around with Excel VBA stuff, there are often three basic “Clipboards” hanging around that no one really understands ( http://www.eileenslounge.com/viewtop...art=20#p246887 )
_ Excel Clipboard
_ Windows Clipboard (Sometimes referred to as the System Clipboard)
_ Office Clipboard
Introduction
This is my light hearted interpretation: You might want to skip this.. and go on to ….Early and Late Binding the DataObject, that is to say the MSForms.DataObject…
Way back when Microsoft started playing with Windows things, some people in authority abused their authority badly by having their entire IT department trying to work out how to put a pretty picture or diagram in a report they were doing to try and contribute to making them look good to get a not deserved pay rise.
There was the ideas discussed at the outset of this Thread of some all encompassing idea of actively at run time Xtraordinary Object Linked and Embedded Component Object Model to make , as most practical usage, ease of putting one application in another. They never really got it right and while they still kept trying real life pressures meant something had to be done that mostly worked, so the end result was that we have a few clipboards. They work as independent software and with a bit of constant tweaking, such as through updates, they work after a fashion. We are still left with the remnants of doing it as they originally wanted and indeed the whole ActiveX OLE COM CodsWollups has grown into a beast that everyone is afraid of admitting they know nothing about. Inevitable then we have some object close to hand, or Class that is a library that can be regarded as to do with the whole ActiveX OLE COM CodsWollups, and with some justification we can say that a A DataObject is a standard OLE object. In fact it is very limited what you can do with a Data object. You can pass text into or get text out of the clipboard, but then the actual Clipboard can do that, or you can do that with API calls. It is all deliberately left vague to disguise the mess made at the start and to make it all sound more clever than it is.
Alternatively, if you want to put all that mildly and politely……. MSForms library contains an object called the DataObject that provides support for working with text strings on the Windows clipboard. VBA does not support the data type required for other, non-text, values on the clipboard. …. … later you can die ……. … you are experiencing a car accident…. The hell I am…no robot. https://www.youtube.com/watch?v=qhAFWW-p7PQ......
The end result of all that is that in a very round about sort of way, we have something that can be used in a few simple code lines to do something, for example of the form:
Do a typical Excel VBA Copy thing on a range; get hold of how that might look in a continuous single string form in a clipboard;
manipulate that somehow using string manipulation functions and techniques;
put that back in a modified but recognisable Excel range form and do a typical Excel VBA Paste back out
Pseudo code:
Excel Range Copy
Get some string version from some clipboard using a DataObject method
__Do some modification of the string
Replace the version previously got using another DataObject method
Excel Range Paste
(You can usually do something just as good directly with the clipboard to replace the DataObject bit… )
We know that works, as it has been tried. Exactly why is lost in the spaghetti that is way the clipboards are organised. It is thought that we are likely paying around with the Windows Clipboard. But somehow the clipboards are related or the above would not work. No one is quite sure anymore what is happening
Dataobject
If this has any speciality, it is probably that being there from the start it has some inside knowledge that a lot of things don’t, and moving text strings about with it, ( which of course is extremely fundamental to computing ) , often results in them coming on in the right place. If you are looking to use the “clipboard” in its general term to move stings about, then this is a good thing to get familiar to using.
Working example.
This will be done in a somewhat overview way, as is the typical usage in a final coding. It centres on using a methods to
_ get ext out of a . ..clipboards….
and to
_ put a text into ..clipboards….
In the next post we will try to makes some sense, at least as far as is possible, about what is actually going on and what the ..clipboards…. is or are
Early and Late Binding the DataObject, that is to say the MSForms.DataObject
MSFORMS, Forms , UserForms
If you are familiar with Visual Basic generally, then you may know that Windows and Forms and user Forms are the basis technology for most of Microsoft Windows stuff. The DataObject Class is held in the larger class of MSForms , Microsoft Forms 2.0 Object Library
Early Binding
Add a UserForm and then remove it
The library would be required for the Visual Basic Forms , ( typically referred to as UserForms), which have many similarities to the Forms in Visual Basic. They differ in one respect in that the UserForm cannot exist as a standalone program. Whether by coding or manually we use an available .Adding process to get one, in a similar way to that which we must create new worksheets. Part of the .Adding process for a UserForm will add the references to MSForms , Microsoft Forms 2.0 Object Library.
Checking the reference
Inn the usual way, (Extras) – References(Verweise) - scroll down to Microsoft Forms 2.0 Object Library -- put checkmark in.
Note if you cannot find , or it is not there, ..you can add that manually: VBA Editor – Tools(Extras) – References(Verweise) -- Browse -- and find FM20.DLL file under a path similar to C:\WINDOWS\system32, and select it -- Open -- OK.
RefMSFORMS.JPG : https://imgur.com/8zKpyr2
Attachment 2188
Early Binding Example
See next post
Ref
http://www.eileenslounge.com/viewtop...art=20#p246887
https://docs.microsoft.com/en-us/off...-the-clipboard
http://excelmatters.com/2013/10/04/l...ms-dataobject/
https://stackoverflow.com/questions/...ently-on-the-c
https://stackoverflow.com/questions/...60767#54960767
https://docs.microsoft.com/de-de/off...-the-clipboard
https://docs.microsoft.com/de-de/off...-the-clipboard
https://social.msdn.microsoft.com/Fo...d?forum=isvvba
https://www.spreadsheet1.com/how-to-...excel-vba.html
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
https://www.youtube.com/watch?v=SIDLFRkUEIo&lc=UgzTF5vvB67Zbfs9qvx4AaABAg
https://www.youtube.com/watch?v=v_1iqtOnUMg&lc=UgxLtKj969oiIu7zNb94AaABAg
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=Ugxq4JHRza_zx3sz0fx4AaABAg
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=Ugxq4JHRza_zx3sz0fx4AaABAg
https://www.youtube.com/watch?v=f7xZivqLZxc&lc=UgzMCQUIQgrbec400jl4AaABAg
https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg
https://www.youtube.com/watch?v=ITI1HaFeq_g&lc=Ugx12mI-a39T41NaZ8F4AaABAg.9iDQqIP56NV9iFD0AkeeJG
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw
https://www.youtube.com/watch?v=tPRv-ATUBe4&lc=UgzFkoI0n_BxwnwVMcZ4AaABAg
https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9htG01cKBzX
https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw6UrV69zpeKvLOeOV4AaABAg.9ht16tzryC49htJ6TpIO XR
https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwMKwGZpDjv7vi7pCx4AaABAg
https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw6UrV69zpeKvLOeOV4AaABAg.9ht16tzryC49htOKs4jh 3M
https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgxVW-am20rQ5GFuJ9F4AaABAg
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
Bookmarks