PC Review


Reply
Thread Tools Rate Thread

AutoKeys: global copy / cut: how do I enable for just one form?

 
 
carriolan@blootoo.com
Guest
Posts: n/a
 
      12th Feb 2006
Hi
I have used Autokeys to disable 'copy' and 'cut' (CTRL and C and CTRL
and X) with 'CancelEvent'. However I want users to be able to copy
from just one form. How do I do this please?
Thanks
--
Carriolan
--
Carriolan
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      12th Feb 2006
What about giving them a Copy button?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
> I have used Autokeys to disable 'copy' and 'cut' (CTRL and C and CTRL
> and X) with 'CancelEvent'. However I want users to be able to copy
> from just one form. How do I do this please?
> Thanks
> --
> Carriolan
> --
> Carriolan



 
Reply With Quote
 
carriolan@blootoo.com
Guest
Posts: n/a
 
      13th Feb 2006
Hi Doug,
Sounds great, but I am relatively green. How do I make a button appear
and then restrict its use to one form only?
Regards

On Sun, 12 Feb 2006 10:53:46 -0500, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:

>What about giving them a Copy button?

--
Carriolan
 
Reply With Quote
 
Douglas J Steele
Guest
Posts: n/a
 
      13th Feb 2006
I was suggesting putting a button on your form (label it Copy), and have it
copy to the clipboard. You can use Screen.ActiveForm to ensure that it's
only being used on that form.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


<(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Hi Doug,
> Sounds great, but I am relatively green. How do I make a button appear
> and then restrict its use to one form only?
> Regards
>
> On Sun, 12 Feb 2006 10:53:46 -0500, "Douglas J. Steele"
> <NOSPAM_djsteele@NOSPAM_canada.com> wrote:
>
> >What about giving them a Copy button?

> --
> Carriolan



 
Reply With Quote
 
carriolan@blootoo.com
Guest
Posts: n/a
 
      14th Feb 2006
Doug
Could you help me on the coding as I am pretty green in this area.
Thanks

On Mon, 13 Feb 2006 07:25:22 -0500, "Douglas J Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:

>I was suggesting putting a button on your form (label it Copy), and have it
>copy to the clipboard. You can use Screen.ActiveForm to ensure that it's
>only being used on that form.

--
Carriolan
 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      15th Feb 2006
Depends on what you're trying to copy. It could be as simple as
DoCmd.RunCommand acCopy, or you might have to resort to APIs, such as is
illustrated in http://www.mvps.org/access/api/api0042.htm and/or
http://www.mvps.org/access/api/api0049.htm at "The Access Web".

You might also check the following KB articles:
http://support.microsoft.com/?id=138909
http://support.microsoft.com/?id=138910


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Doug
> Could you help me on the coding as I am pretty green in this area.
> Thanks
>
> On Mon, 13 Feb 2006 07:25:22 -0500, "Douglas J Steele"
> <NOSPAM_djsteele@NOSPAM_canada.com> wrote:
>
>>I was suggesting putting a button on your form (label it Copy), and have
>>it
>>copy to the clipboard. You can use Screen.ActiveForm to ensure that it's
>>only being used on that form.

> --
> Carriolan



 
Reply With Quote
 
carriolan@blootoo.com
Guest
Posts: n/a
 
      15th Feb 2006
Hi Doug
I have studied links that you provided - thanks, but they do not seem
to address what I am trying to do.

I have around 15 forms with bound text boxes displaying text that I do
not want users to copy or cut. However the application allows the
users to record their own notes which I do want them to be able to
copy or cut. The text is displayed in three separate bound text boxes
on a single form. I would like them to highlight the text and use CTRL
C to copy

My idea was to globally prevent copying and cutting using ^C
CancelEvent in AutoKeys and to some how reverse / suspend this global
CancelEvent for this particular for this screen only. However I do not
know how to do this or I even whether or not it can be done or whether
there is an accepted way of doing this.

Regards


On Tue, 14 Feb 2006 21:14:34 -0500, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:

>Depends on what you're trying to copy. It could be as simple as
>DoCmd.RunCommand acCopy, or you might have to resort to APIs, such as is
>illustrated in http://www.mvps.org/access/api/api0042.htm and/or
>http://www.mvps.org/access/api/api0049.htm at "The Access Web".
>
>You might also check the following KB articles:
>http://support.microsoft.com/?id=138909
>http://support.microsoft.com/?id=138910

--
Carriolan
 
Reply With Quote
 
carriolan@blootoo.com
Guest
Posts: n/a
 
      15th Feb 2006
Hi Doug
Alternatively I could adopt your idea of using a copy button as you
originally suggested, but I am too green too use this code. I have set
it up in a module and can run it on click, but I am unable to use it.
It is the content of a bound Text box, 'Text304', which I want to
copy to the clipboard. I tried replacing 'MyString' with 'Text 304',
but I get the error 'The object does not contain the automation object
<< Text304>>' - how and where do I insert it into the code please?

Regards


Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) _
As Long
Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) _
As Long
Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, _
ByVal dwBytes As Long) As Long
Declare Function CloseClipboard Lib "User32" () As Long
Declare Function OpenClipboard Lib "User32" (ByVal hwnd As Long) _
As Long
Declare Function EmptyClipboard Lib "User32" () As Long
Declare Function lstrcpy Lib "kernel32" (ByVal lpString1 As Any, _
ByVal lpString2 As Any) As Long
Declare Function SetClipboardData Lib "User32" (ByVal wFormat _
As Long, ByVal hMem As Long) As Long

Public Const GHND = &H42
Public Const CF_TEXT = 1
Public Const MAXSIZE = 4096

Function ClipBoard_SetData(MyString As String)
Dim hGlobalMemory As Long, lpGlobalMemory As Long
Dim hClipMemory As Long, X As Long

' Allocate moveable global memory.
'-------------------------------------------
hGlobalMemory = GlobalAlloc(GHND, Len(MyString) + 1)

' Lock the block to get a far pointer
' to this memory.
lpGlobalMemory = GlobalLock(hGlobalMemory)

' Copy the string to this global memory.
lpGlobalMemory = lstrcpy(lpGlobalMemory, MyString)

' Unlock the memory.
If GlobalUnlock(hGlobalMemory) <> 0 Then
MsgBox "Could not unlock memory location. Copy aborted."
GoTo OutOfHere2
End If

' Open the Clipboard to copy data to.
If OpenClipboard(0&) = 0 Then
MsgBox "Could not open the Clipboard. Copy aborted."
Exit Function
End If

' Clear the Clipboard.
X = EmptyClipboard()

' Copy the data to the Clipboard.
hClipMemory = SetClipboardData(CF_TEXT, hGlobalMemory)

OutOfHere2:

If CloseClipboard() = 0 Then
MsgBox "Could not close Clipboard."
End If

End Function




On Tue, 14 Feb 2006 21:14:34 -0500, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:

>Depends on what you're trying to copy. It could be as simple as
>DoCmd.RunCommand acCopy, or you might have to resort to APIs, such as is
>illustrated in http://www.mvps.org/access/api/api0042.htm and/or
>http://www.mvps.org/access/api/api0049.htm at "The Access Web".
>
>You might also check the following KB articles:
>http://support.microsoft.com/?id=138909
>http://support.microsoft.com/?id=138910

--
Carriolan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I enable Copy / Paste support on a Web Form =?Utf-8?B?Q2hyaXM=?= Microsoft ASP .NET 1 24th May 2007 05:42 PM
Make function in form class module visible to AutoKeys macro =?Utf-8?B?WFA=?= Microsoft Access VBA Modules 6 6th Mar 2007 11:03 PM
Autokeys macro: how can you get the "normal" access key behaviour after the autokeys routine A C Microsoft Access Macros 1 25th Nov 2005 07:59 AM
Global AutoKeys Rob Diamant Microsoft Access 0 20th Oct 2004 10:33 PM
Can I use AutoKeys only for a particular form? =?Utf-8?B?QXZpcg==?= Microsoft Access Forms 1 29th Apr 2004 05:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:52 AM.