John W. Colby
jwcolby at colbyconsulting.com
Thu Aug 18 11:02:08 CDT 2005
LOL, OK, so now the question is... How can I copy the clipboard back to a string... John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Thursday, August 18, 2005 11:49 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] copy string to clipboard The original question was 'So how can I copy the value of this string to the clipboard?' -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Thursday, August 18, 2005 11:00 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] copy string to clipboard Where is the matching ClipGetText? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Thursday, August 18, 2005 10:54 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] copy string to clipboard Which is simpler ClipPutText MyString Or Clipboard.SetText "Jim D" Answer: they are both real simple. But In the first case all you need is the code for the ClipPutText routine stashed away in a module, which you can then treat as a black box, and in the second case you have to distribute a DLL and ensure that it gets registered properly (assuming the user has privileges to register DLLs). I know which way I would go! :-) Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim DeMarco Sent: Thursday, August 18, 2005 9:56 AM To: Access Developers discussion and problem solving Subject: RE: [AccessD] copy string to clipboard If you have VB and don't mind shipping a dll with your app it's much simpler. <snip> Clipboard.SetText "Jim D" Me.Text1.Text = Clipboard.GetText </snip> Jim DeMarco -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Jim Lawrence Sent: Thursday, August 18, 2005 2:25 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] copy string to clipboard Hi Bruce: I have some code that I have been using for years, mostly for debugging purposes. It just copies a string up into the clip board and it doesn't look as ugly as the code from Terry Kreft. The following code resides in a miodule declaration area: <code> 'Whole bunch of APIs which allow text to be copied to clipboard... Private Declare Function OpenClipboard Lib "User32" (ByVal hWnd&) As Long Private Declare Function EmptyClipboard Lib "User32" () As Long Private Declare Function GetClipboardData Lib "User32" (ByVal wFormat&) As Long Private Declare Function SetClipboardData Lib "User32" (ByVal wFormat&, _ ByVal hMem&) As Long Private Declare Function CloseClipboard Lib "User32" () As Long ' Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags&, _ ByVal dwBytes&) As Long Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem&) As Long Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem&) As Long ' Private Declare Function lstrcpy Lib "kernel32" (ByVal lpString1 As Any, _ ByVal lpString2 As Any) As Long </code> And the remainder is place in a module's function area: <code> Public Sub ClipPutText(lsText As String) ' Stores text on the clipboard Dim hMem As Long Const GHND = &H42 hMem = GlobalAlloc(GHND, Len(lsText) + 1) lstrcpy GlobalLock(hMem), lsText If GlobalUnlock(hMem) = 0 Then If OpenClipboard(0&) <> 0 Then EmptyClipboard SetClipboardData 1, hMem CloseClipboard End If End If End Sub </code> And it can be called from anywhere; forms, reports or modules like so: ClipPutText MyString 'Place the string 'MyString into the clipboard HTH Jim -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bruen, Bruce Sent: Wednesday, August 17, 2005 7:29 PM To: Access Developers discussion and problem solving Subject: [AccessD] copy string to clipboard This must! be simple. I have a string variable created by concatenating the values of several form fields. So how can I copy the value of this string to the clipboard? Private Sub Command35_Click() Dim refstr As String refstr = "RCRef=|" & Me.ucref & "|" & Me.testname & "|" & Me.TestID & "|" Debug.Print refstr Stop ':-( Runcmd accmdStickTheStringInTheClipboard :-( End Sub tia bruce This e-mail and any attachments may contain confidential information that is intended solely for the use of the intended recipient and may be subject to copyright. If you receive this e-mail in error, please notify the sender immediately and delete the e-mail and its attachments from your system. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. Any opinion expressed in this e-mail and any attachments is not an opinion of RailCorp unless stated or apparent from its content. RailCorp is not responsible for any unauthorised alterations to this e-mail or any attachments. RailCorp will not incur any liability resulting directly or indirectly as a result of the recipient accessing any of the attached files that may contain a virus. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com **************************************************************************** ******* "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". **************************************************************************** ******* -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com