SendKeys

G

Guest

Help!! I have a field that might have a paragraph or 2 in it. The user would
like to have a button that goes to the top of the field and inserts the date
and time. Can I do this with a macro using the sendkeys option? I'm able to
get to the top of the field by using sendkeys to send an:
{F2}{HOME}
then insert the date and time by
^; ^:
but it only works if there are no returns in the actual text, if there are
returns in the text, it enters the date and time in the blank line between
the paragraphs.
Thanks
 
G

Guest

Hi,
you should avoid sendkeys as much as possible. It can cause fatal errors.
Additionally you should try to adapt VBA code and drop macros. They are very
limited and cannot handle error handling.
I assume you have a control on a form bound to a memo field in a table,
correct?
You could try code like this on the on click event of a button:

Me.YourControl.Value = Me.YourControl & Now()

Untested,
HTH
Good luck
 
S

Steve Schapel

Theitman,

The general wisdom of the sages is to avoid SendKeys macros. They are
just too much trouble, and there is always another way to do the same
thing. In this case, use a SetValue action instead, with these
arguments (for example)...
Item: [NameOfTextbox]
Expression: Format(Now(),"dd-mmm-yy hh:nnam/pm") & Chr(13) & Chr(10) &
[NameOfTextbox]
 
S

Steve Schapel

freakazeud said:
Hi,
you should avoid sendkeys as much as possible. It can cause fatal errors.

It can? I agree that SendKeys is not recommended approach... but "fatal
errors"?
 

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

Similar Threads


Top