why does vb not recognise outlook code?

N

ninjaneer

Hi there

I'm still a complete amateur on outlook vba, so please bear with me.

I use Outlook 2003 (that I recieved with a student package of Office) on a
Windows 7 RC PC. I want to create a Macro that formats a mail as html. I
found some example code on the internet, but it gives errors claiming not to
recognize the objects:
"Method or data member not found" in response to
Application.ActiveInspector.CurrentItem.BodyFormat = olFormatPlain
or "User-defined type not found" in response to >Dim olMail As
Outlook.MailItem

Any ideas on how I can reach my goal to create a Macro that formats a mail
as html or to address the errors?

Thank you for reading my post!

Pieka
 
M

Michael Bauer [MVP - Outlook]

That sounds like the code isn't running in Outlook but in another
application. There you need to add a reference on Outlook to make its object
model available: Click Tools/References, and add "Microsoft Outlook x
Library".

Also, 'Application' in VBA always refers to the Application of the host
application. For instance, if the code runs in Excel, Application refers to
the root object of Excel, not to the one of Outlook. That is you need to dim
a variable as Outlook.Application, and set it to the right object.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
<http://www.vboffice.net/product.html?pub=6&lang=en>


Am Sun, 21 Feb 2010 05:58:01 -0800 schrieb ninjaneer:
 

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

Top