Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / February 2004

Tip: Looking for answers? Try searching our database.

add text at cursor position

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon Sunke - 18 Feb 2004 17:45 GMT
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
Eric Legault [MVP - Outlook] - 24 Feb 2004 20:52 GMT
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.

Signature

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

> hello
>
[quoted text clipped - 3 lines]
> regards
>  Simon
Simon Sunke - 24 Feb 2004 22:01 GMT
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
Eric Legault [MVP - Outlook] - 27 Feb 2004 19:25 GMT
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/

Signature

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

> Hi Eric!
>
[quoted text clipped - 14 lines]
> Thanks
>  Simon
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.