add text at cursor position

  • Thread starter Thread starter Simon Sunke
  • Start date Start date
S

Simon Sunke

hello

how can a macro write some text at the current cursor position, i.e. when
writing an email or editing a task?

regards
Simon
 
You can try using SendKeys. However, if your macro is being fired by a
toolbar button, the cursor will have left the text area. You'd have to try
sending TAB keys to get the cursor into the proper position, and then send a
specified string to that area.

A cleaner approach would be to just write the text to the assumed area using
the Outlook Object model - the To or Body properties for example.
 
Hi Eric!

Eric Legault said:
You can try using SendKeys. However, if your macro is being fired by a
toolbar button, the cursor will have left the text area. You'd have to try
sending TAB keys to get the cursor into the proper position, and then send a
specified string to that area.
certainly... but I'd put it on a keyboard-shortcut
A cleaner approach would be to just write the text to the assumed area using
the Outlook Object model - the To or Body properties for example.
How can I access that Outlok Object Model? Is there a SDK or tutorial?

Thanks
Simon
 
By keyboard shortcut, do you mean adding the & identifier within the toolbar
button name so that it can be activated by ALT+letter? That might be a
problem, because then that button will have focus and you may not be able to
get the focus back to the text box that requires the focus. Give it a shot
though, it might work.

If you are talking about assigning Outlook functions to a particular
keyboard stroke(s), like you can in Word - you can't do that in Outlook
unfortunately.

For best information on the Outlook Object Model, use the Object Browser in
the Outlook VBA IDE (Alt+F11, then F2), or reference the VBAOL10.chm file
(number depends on version) in your Office installation directory.

More info on Outlook VBA:
http://www.slipstick.com/dev/vb.htm
http://www.outlookcode.com/

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault
 
Back
Top