Object Required?

F

Fred Holmes

The code statement:

Selection.TypeText Text:="This is sample text."

Works fine in VBA code in MS Word. The text string is inserted into
the document at the insertion point.

But when using Outlook 2003's VBA editor (for plain text messages, not
using Word as the mail message editor) the same statement fails with
an "object requrired" debug message. I presume that the required
object is something like "Current message body." but where do I find a
pick list or other description of appropriate objects?

Thanks,

Fred Holmes
 
S

Sue Mosher [MVP-Outlook]

When in doubt, check the object browser: Press ALt+F11 to open the VBA
environment in Outlook, then press F2. Switch from <All Libraries> to
Outlook to browse all Outlook objects and their properties, methods, and
events. Select any object or member, then press F1 to see its Help topic.

In the object browser, you can easily discover that Outlook's only Selection
object refers to a selection of items in an Explorer (i.e. folder) window.

FYI, there is a newsgroup specifically for general Outlook programming
issues "down the hall" at microsoft.public.outlook.program_vba or, via web
interface, at
http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

Back to your action issue, is Word your email editor?
 
Top