Assigning VBA.SendKeys ("^v") to a variable

B

Bruce Maston

After you use VBA.SendKeys ("^c") to capture data in a textbox, is there a
way to assign this information to a variable?

A simple line of code strVariable = VBA.SendKeys ("^v") gets a compile error
"expected function or variable"

Thank you.
 
M

Mr. B

After you use VBA.SendKeys ("^c") to capture data in a textbox, is there a
way to assign this information to a variable?

A simple line of code strVariable = VBA.SendKeys ("^v") gets a compile error
"expected function or variable"

Thank you.

Bruce,

Take a look at using the Clipboard through code as opposed to using
the sendkeys function. Take a look at:

http://www.mvps.org/access/api/api0049.htm

While the sendkeys my seem like a good approach, actually it can have
problems. The best bet is the clipboard.

If you just need to hold on to the value of a textbox, you could just
use a variable as in:

dim strMyVal as String
strMyVal = me.NameOfTexbox

Hope this helps.

Mr. B
 
Top