If the user has copied a file to the clipboard in the file system, I would like the user to return to an Excel spreadsheet and click a button. The code behind this button should paste this file to a predefined folder.
I know it is possible through VBA to read/write a string to/from the clipboard. Is it possible in VBA to read a copied file from the clipboard and place it in a folder (file doesn't need to be opened during this operation)?
When you copy a file to the clipboard in Explorer, the file itself isn't placed on the clipboard (image what would happen if you copy a file of 200GB :) ). Instead Explorer puts e.g. the file's path on the clipboard in a special clipboard format (i.e. non-textual). You can read more on the formats at MSDN.
I haven't worked closely with these clipboard formats, but it seems that in most cases you would look for the CF_HDROP format. You'd need quite some VBA to massage the data into the file's path, but from there on it's a simple file copy to complete the operation.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments