Problem with email generated from VB.NET using Outlook

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,
A little while ago I asked if anyone could help me with how to create an
email using MS Outlook that contained an embedded picture file.
Thanks to Jay Harlow I was able to get this working using a code example
from http://www.outlookcode.com/d/code/htmlimg.htm that details the
procedure and with a bit of tweaking I managed to get it working really
well.

I now find that there is a new user on a laptop that always gets an error at
the point where the code creates an Outlook object. I have included all the
interop DLLs with the application and for all users, the code works, except
this one.

The code snippet that is having the problem is:

' Outlook objects
Dim objApp as Outlook.Application
Dim l_Msg As MailItem
Dim colAttach As Outlook.Attachments
Dim l_Attach As Outlook.Attachment
Dim oSession As MAPI.Session

' CDO objects
Dim oMsg As MAPI.Message
Dim oAttachs As MAPI.Attachments
Dim oAttach As MAPI.Attachment
Dim colFields As MAPI.Fields
Dim oField As MAPI.Field

Dim strEntryID As String

' create new Outlook MailItem
Set objApp = CreateObject("Outlook.Application","") '<== PROBLEM OCCURS
HERE!!
Set l_Msg = objApp.CreateItem(olMailItem)
' add graphic as attachment to Outlook message
' change path to graphic as needed
Set colAttach = l_Msg.Attachments
Set l_Attach = colAttach.Add("c:\test\graphic.jpg")
l_Msg.Close olSave
strEntryID = l_Msg.EntryID
Set l_Msg = Nothing
etc ...

The user has the same DLLs installed in the application folder as all the
other users, the difference is that they all had MS Office 2000 and then
upgraded to Outlook 2003 as part of the Small Business Server 2003
installation, where the new user only ever had Outlook 2003.

I am using the following DLLs:
===============================
DLL Version
Interop.MAPI.dll 1.21.0.0
Interop.Microsoft.Office.Core.dll 2.3.0.0
Interop.Outlook.dll 9.2.0.0
================================

Can anyone explain why the CreateObject command is failing on that one
machine? It's driving me nuts!

--
Siv
Martley, Near Worcester, UK.


.



Relevant Pages

  • Re: DocOutlook Landkarte Deutschland
    ... Informationen von Smarttools Outlook Weekly vom 11/19/25.02.2004 ... Karten und Routenplanung direkt aus Outlook aufrufen, ... ByVal Inspector As Inspector) Dim cb As CommandBar Dim mnu As ... ByVal lpOperation As String, _ ...
    (microsoft.public.de.outlook)
  • Re: KONTAKTE - KARTE ZUR ADRESSE ANZEIGEN
    ... Karten und Routenplanung direkt aus Outlook aufrufen, ... Wenn Sie einen Kontakt in Outlook anlegen, geben Sie neben dem Namen, der ... ByVal Inspector As Inspector) Dim cb As CommandBar Dim mnu As ... ByVal lpOperation As String, _ ...
    (microsoft.public.de.outlook)
  • Re: HTML Item properties vs. Regular item properties
    ... Why would Outlook record different times for the HTTP ... and the default folder? ... Dim app As Outlook.Application ... "Dmitry Streblechenko" wrote: ...
    (microsoft.public.outlook.program_vba)
  • Re: VBA shutdown error Outlook
    ... In Outlook VBA there is an intrinsic Application object. ... Dim oExpl As Outlook Explorer ... > Public myFlag As Boolean ... > Exit Sub ...
    (microsoft.public.office.developer.outlook.vba)
  • RE: How to copy the format in word document to Outlook Mail
    ... This is where I'm afraid you'll have to do your homework Sangeeta. ... Eric Legault (Outlook MVP, MCDBA, MCTS: ... Dim objOutlook As Outlook.Application ... Dim objWordDoc As Word.Document ...
    (microsoft.public.outlook.program_vba)