why does vb not recognise outlook code?

  • Thread starter Thread starter ninjaneer
  • Start date Start date
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
 
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:
 
Back
Top