The required Visual Basic 6.0 function will be part of a PowerPoint COM Add-In. The COM Add-In makes use of the Clipboard for some of its functionality. If the user had some data in the Clipboard before invoking the COM Add-In functionality, the user's data in the Clipboard is currently overwritten.
The required Visual Basic 6.0 function needs to save the contents of the Clipboard "bit-by-bit" in a memory buffer and restore it back to the Clipboard later on (after the COM Add-In has used the Clipboard for its purposes). This needs to work both for the simple Windows Clipboard as well as for the Office Clipboard.
- Documented Visual Basic 6.0 source code
- Single .bas module, no forms, no classes
- Pure VB6, standard Windows API, no other components (.dll, .ocx)
- No temporary files are to be created (all intermediate operations need to happen in memory, not on disk)
- Error handling
Public Sub saveClipboard()
if not clipboard is empty
get all contents
save contents to memory buffer
Public Sub restoreClipboard()
if memory buffer is not empty
restor contents from memory buffer
1. Fully functional sample .exe which save and restores data from and back to clipboard
2. Fully documented source code