Category: Development

Share the Clipboard with VBA and the Windows API

Accessing the clipboard in Windows becomes quite tricky in VBA, particularly if you have to stay 32 and 64 bits compatible.

Here’s my compilation of portable routines, inspired by MSDN, Internet scraping and good sense.

First the Declares section (I know, it pours out of the frame on the right, just select and copy the text):

Then the VBA code:

Update: just a quick sample (Access VBA):

There’s an Access 2016 demo database (on, open it, go to the VBA editor (ALT+F11), go to the debug Windows (CTRL+G), type “Test” (without the quotes of course) and hit ENTER; any text in the clipboard will be displayed in the debug window.


Microsoft Access Databases ADO connection strings for 32/64 bits

If you try to open a connection to an Access database via ADO, you’ll have to use a different provider, whether you’re coding for 32 or 64 bits environments.

Here’s a utility function I use for that (updated 25.02.2014):

Of course you have to have the correct jet engine files installed on the target computer, but just a warning here: you’ll find quite a few links to download the Access 2010 database engine redistributable package, but if you’re using Office 2013 and you install this redistributable package, as soon as you’ll start an Office application, the repair feature of the Office installer will trigger.

You can find the GetFileExt() function in this post.