PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming add text at cursor position

Reply

add text at cursor position

 
Thread Tools Rate Thread
Old 18-02-2004, 05:45 PM   #1
Simon Sunke
Guest
 
Posts: n/a
Default add text at cursor position


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


  Reply With Quote
Old 24-02-2004, 08:52 PM   #2
Eric Legault [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: add text at cursor position

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.

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


"Simon Sunke" <REMOVE_THIS_2_MAIL_Simi@SimiTec.ch> wrote in message
news:c108c7$1c1v5h$1@ID-78521.news.uni-berlin.de...
> 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
>
>



  Reply With Quote
Old 24-02-2004, 10:01 PM   #3
Simon Sunke
Guest
 
Posts: n/a
Default Re: add text at cursor position

Hi Eric!

"Eric Legault [MVP - Outlook]" <elegaultZZZ@REMOVEZZZmvps.org>wrote:
> 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


  Reply With Quote
Old 27-02-2004, 07:25 PM   #4
Eric Legault [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: add text at cursor position

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


"Simon Sunke" <REMOVE_THIS_2_MAIL_Simi@SimiTec.ch> wrote in message
news:c1ghj9$1e8h6m$1@ID-78521.news.uni-berlin.de...
> Hi Eric!
>
> "Eric Legault [MVP - Outlook]" <elegaultZZZ@REMOVEZZZmvps.org>wrote:
> > 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
>
>



  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off