Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>User Leigh Webber on the social.msdn.microsoft.com site posted VBA code implementing an easy-to-use clipboard interface that uses the Windows API:</p> <p><a href="http://social.msdn.microsoft.com/Forums/en/worddev/thread/ee9e0d28-0f1e-467f-8d1d-1a86b2db2878" rel="nofollow">http://social.msdn.microsoft.com/Forums/en/worddev/thread/ee9e0d28-0f1e-467f-8d1d-1a86b2db2878</a></p> <p>You can get <a href="http://web.sisgarbe.pt/sispub/WebShared/EXCEL/ClipboardFuncs/SampleExcelClipboardFunctions.zip" rel="nofollow">Leigh Webber's source code here</a></p> <p>If this link doesn't go through, search for "A clipboard object for VBA" in the Office Dev Center > Microsoft Office for Developers Forums > Word for Developers section.</p> <p>I created the two classes, ran his test cases, and it worked perfectly inside Outlook 2007 SP3 32-bit VBA under Windows 7 64-bit. It will most likely work for Access. Tip: To rename classes, select the class in the VBA 'Project' window, then click 'View' on the menu bar and click 'Properties Window' (or just hit F4).</p> <p>With his classes, this is what it takes to copy to/from the clipboard:</p> <pre><code>Dim myClipboard As New vbaClipboard ' Create clipboard ' Copy text to clipboard as ClipboardFormat TEXT (CF_TEXT) myClipboard.SetClipboardText "Text to put in clipboard", "CF_TEXT" ' Retrieve clipboard text in CF_TEXT format (CF_TEXT = 1) mytxt = myClipboard.GetClipboardText(1) </code></pre> <p>He also provides other functions for manipulating the clipboard.</p> <p>It also overcomes <strong>32KB</strong> <strong>MSForms_DataObject.SetText</strong> limitation - the main reason why <strong>SetText</strong> often fails. However, bear in mind that, unfortunatelly, I haven't found a reference on Microsoft recognizing this limitation.</p> <p>-Jim</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload