Private Declare PtrSafe Function GlobalUnlock Lib "kernel32" ( ByVal hMem As LongPtr) As LongPtr UPDATE: I have modified the API declarations to work with both 64-bit and 32-bit versions of Microsoft Office It has three parts: an API declaration section, a Function routine, and then I used a similar subroutine macro to place the desired text into the Clipboard. Copy To Clipboard With Windows APIÄ«elow is the API workaround suggested by Microsoft to get around the "SetText" bug. The support member pointed to a solution using a Windows API as a workaround (shown in the next section). Someone posted that they were actually able to troubleshoot this problem with a Microsoft support member a couple years ago (maybe in 2010) and that person determined it to be a bug. Luckily, there were many others who were running into this very issue on the forums. It took me forever to narrow down what was causing this to happen (the source code was very long) and of course, the problem ended up being a bug on the part of Microsoft! This code worked perfectly on my work computer (using Windows 7/Excel 2007), however it kept copying just two question marks to the clipboard while executing the VBA code on my home computer (using Windows 8.1/Excel 2013). I initially started investigating how to copy text to the clipboard while running someone else's code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |