How to use Terry Kreft's API functions

J

justme

http://www.mvps.org/access/api/api0049.htm
API: Copy variables/control contents to memory


Hi,

I've copied the code to standard module. Unsure of what functions are
available. Also, do I always have to open the clipboard then close it?

Please give examples of how to use or where I can find a list of all
functions. Thanks.
 
A

Albert D. Kallal

Please give examples of how to use or where I can find a list of all
functions. Thanks.

The lsit of fuctiosn is in the text you linked to. just take a quick skim of
the function ames.

The example code is for grabbing, or place a value into the clip borard.

Obvilsy, the first 2 are named appraocle.

they are:

Function ClipBoard_GetText() As String

and

Function ClipBoard_SetText(strCopyString As String) As Boolean


So, to use in code, you can go

dim strMyString as string


strMyString = "have a nice day"

ClipBoard_SetText strMyString

Now, if you go edit-Paste into a field (or lanuc ms-word, and go
edit->paste, you will paste the above test..

Furhter, ifyou open up a word docuemnt, and hghtl some text, and the go
eit->copy.

Now, in ms-acces, if you ahve a form with a butt, you could show that text
like:

msgbox ClipBoard_GetText()

So, just place the sample code into a standard module in ms-access. (call it
basapi, or some name..or even module1 if you wish -- just make sure the
module name don't conflict with a function or name of a sub inside.
 
A

Albert D. Kallal

justme said:
But what are the Open and close clipboard functions for?

Ah, ok. It thought your question was how to use these functions, not what
are they for. My apologies.

The functions are used to allow you to copy from "memory" (that means
variables in ms-access) to the standard windows clipboard.

This is a handy feature.

For example, we could place a button on a form that displays a persons
address fields. You could have a button called:

"copy address to clipboard"

When the user press the button, you would take all the data from the fields
to make up a complete address.

You then use the ClipBoard_SetText function to copy this data from your
form to the clipboard.

Then, the user could open up word, or any other application, and when they
go
edit->paste, the address would be pasted.

From the link you gave, the following text clearly explains the use here:
:
<quote>
Although the built in RunCommand method does have a constant which allows
you to copy data to clipboard, it's heavily dependent on controls on the
form. You must setFocus to the control and select the text first before you
can use RunCommand on the selection.
Here are a few functions which let you copy and paste data to/from
clipboard.

</quote>

So, the text in the link you gave it quite clear. These are functions simply
copy data from "memory" (variables) to the windows standard clipboard, or
from the clipboard
to memory variblaes in ms-access.
 
J

justme

Thank you for your patience, Albert, but I do not understand if I would use
the "OpenClipboard" or "CloseClipboard" functions in my vba.
 
A

Albert D. Kallal

justme said:
Thank you for your patience, Albert, but I do not understand if I would
use
the "OpenClipboard" or "CloseClipboard" functions in my vba.

No, you would not. Those declares are used by the code example.

so, we really only have 3 functions.

ClipBoard_GetText() - this gets the text or data from the clipboard

ClipBoard_SetText - this lets you send (set) text to the clipboard

CopyOlePiccy(Piccy As Object) - this would be for picture, or bindary data,
and again is likey not much use in ms-access....


The other functions are not listed, and they are used internally by the
above functions. Really, the only two functions of use are the first two....

So, in your could go:

clipboard_SetTest "hello how are you"

Now, if you go edit->paste (in any application that is running), you will
paste the above text....
 
J

justme

THANK YOU!

Albert D. Kallal said:
No, you would not. Those declares are used by the code example.

so, we really only have 3 functions.

ClipBoard_GetText() - this gets the text or data from the clipboard

ClipBoard_SetText - this lets you send (set) text to the clipboard

CopyOlePiccy(Piccy As Object) - this would be for picture, or bindary data,
and again is likey not much use in ms-access....


The other functions are not listed, and they are used internally by the
above functions. Really, the only two functions of use are the first two....

So, in your could go:

clipboard_SetTest "hello how are you"

Now, if you go edit->paste (in any application that is running), you will
paste the above text....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top