VBA - how to get address (folder) of recently copied file from clipboard under Windows 32-bit using VBA? [duplicate]

StackOverflow https://stackoverflow.com/questions/23252660

Question

How to get address (folder) of the most recently copied file from clipboard under Windows 32-bit using VBA (Outlook or Excel 2007) ? This is needed element for macro which will paste hyperlink to file instead of file itself into e-mail message or some Excel file.

I've found that thread about working with windows cliboard with VBA : http://www.pcreview.co.uk/forums/do-clear-copy-clipboard-using-vba-t1642294.html it seems to be quite useful

Was it helpful?

Solution

You would have to query the clipboard for its current data, looking for standard formats like CF_HDROP or CFSTR_FILENAME that you can extract a file path from.

Whether you can actually do that in VBA directly, I do not know. You might need to write a separate native solution in C++ or VB and wrap it in a COM object for VBA to then use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top