473,760 Members | 8,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with email generated from VB.NET using Outlook

Siv
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.Applica tion
Dim l_Msg As MailItem
Dim colAttach As Outlook.Attachm ents
Dim l_Attach As Outlook.Attachm ent
Dim oSession As MAPI.Session

' CDO objects
Dim oMsg As MAPI.Message
Dim oAttachs As MAPI.Attachment s
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("O utlook.Applicat ion","") '<== PROBLEM OCCURS
HERE!!
Set l_Msg = objApp.CreateIt em(olMailItem)
' add graphic as attachment to Outlook message
' change path to graphic as needed
Set colAttach = l_Msg.Attachmen ts
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.dl l 1.21.0.0
Interop.Microso ft.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.
Nov 21 '05 #1
5 3925
I have read that the script blockers in Antivirus programs may block calls
to CreateObject("O utlook.Applicat *ion"). I know Norton Antivirus has such a
script blocker, for example. I did a quick Google search on
CreateObject("O utlook.Applicat *ion") and antivirus that produced some
interesting messages.

Perhaps that is the problem.
"Siv" <ms**********@r emoveme.sivill. com> wrote in message
news:e%******** *******@TK2MSFT NGP11.phx.gbl.. .
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.Applica tion
Dim l_Msg As MailItem
Dim colAttach As Outlook.Attachm ents
Dim l_Attach As Outlook.Attachm ent
Dim oSession As MAPI.Session

' CDO objects
Dim oMsg As MAPI.Message
Dim oAttachs As MAPI.Attachment s
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("O utlook.Applicat ion","") '<== PROBLEM OCCURS
HERE!!
Set l_Msg = objApp.CreateIt em(olMailItem)
' add graphic as attachment to Outlook message
' change path to graphic as needed
Set colAttach = l_Msg.Attachmen ts
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.dl l 1.21.0.0
Interop.Microso ft.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.

Nov 21 '05 #2
Siv
William,
That's something I wouldn't have thought of. The user has McAfee antivirus
on her machine, and the other users have Sophos Antivirus, she also runs MS
Antispyware beta which they don't either as the Sophos suite we have
installed on the desktop machines covers both antivirus and spyware threats.

Have you heard that McAfee does this??

Is it just the script blocking part or some other aspect of McAfee?

Thanks for your help, it gives me an avenue to pursue.
--
Siv
Martley, Near Worcester, UK.
"William LaMartin" <la******@tampa bay.rr.com> wrote in message
news:eq******** *******@TK2MSFT NGP14.phx.gbl.. .
I have read that the script blockers in Antivirus programs may block calls
to CreateObject("O utlook.Applicat *ion"). I know Norton Antivirus has such
a script blocker, for example. I did a quick Google search on
CreateObject(" Outlook.Applica t*ion") and antivirus that produced some
interesting messages.

Perhaps that is the problem.
"Siv" <ms**********@r emoveme.sivill. com> wrote in message
news:e%******** *******@TK2MSFT NGP11.phx.gbl.. .
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.Applica tion
Dim l_Msg As MailItem
Dim colAttach As Outlook.Attachm ents
Dim l_Attach As Outlook.Attachm ent
Dim oSession As MAPI.Session

' CDO objects
Dim oMsg As MAPI.Message
Dim oAttachs As MAPI.Attachment s
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("O utlook.Applicat ion","") '<== PROBLEM OCCURS
HERE!!
Set l_Msg = objApp.CreateIt em(olMailItem)
' add graphic as attachment to Outlook message
' change path to graphic as needed
Set colAttach = l_Msg.Attachmen ts
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.dl l 1.21.0.0
Interop.Microso ft.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.


Nov 21 '05 #3
I haven't used McAfee in years. I am only familiar with Norton Antivirus.
I personally had to disable the script blocking in it to get various things
in Microsoft Word to work, possibly also to get Microsoft Document Imaging
to work. It has been several years, and I can't remember the specifics.

Strange things happen. I recall once discovering that all of a sudden I
could no longer create a data link. I finally traced it to the installation
of a new mouse. Once I substituted the Microsoft driver for the Logitech
driver, everything returned to normal. Now what does a mouse driver have to
do with data links? I think script blocking possibly has more to do with
CreateObject("O utlook.Applicat *ion") than mouse drivers have to do with data
links. I think you can use the CreateObject method in VBScript.

"Siv" <ms**********@r emoveme.sivill. com> wrote in message
news:e0******** *****@TK2MSFTNG P11.phx.gbl...
William,
That's something I wouldn't have thought of. The user has McAfee
antivirus on her machine, and the other users have Sophos Antivirus, she
also runs MS Antispyware beta which they don't either as the Sophos suite
we have installed on the desktop machines covers both antivirus and
spyware threats.

Have you heard that McAfee does this??

Is it just the script blocking part or some other aspect of McAfee?

Thanks for your help, it gives me an avenue to pursue.
--
Siv
Martley, Near Worcester, UK.
"William LaMartin" <la******@tampa bay.rr.com> wrote in message
news:eq******** *******@TK2MSFT NGP14.phx.gbl.. .
I have read that the script blockers in Antivirus programs may block calls
to CreateObject("O utlook.Applicat *ion"). I know Norton Antivirus has such
a script blocker, for example. I did a quick Google search on
CreateObject( "Outlook.Applic at*ion") and antivirus that produced some
interesting messages.

Nov 21 '05 #4
Siv
William
I got the user to turn off "scriptstop per" in McAfee to see if the problem
went away, but it didn't. She also runs MS Anti Spyware so I turned that
off as well and still no good. (Wasn't too keen to have these things turned
off anyway so in some ways I am glad that they weren't the cause of the
problem!).

So the problem must be software and DLL related??
Unless anyone else knows what could be the problem.
--
Siv
Martley, Near Worcester, UK.
"William LaMartin" <la******@tampa bay.rr.com> wrote in message
news:ed******** ******@TK2MSFTN GP14.phx.gbl...
I haven't used McAfee in years. I am only familiar with Norton Antivirus.
I personally had to disable the script blocking in it to get various things
in Microsoft Word to work, possibly also to get Microsoft Document Imaging
to work. It has been several years, and I can't remember the specifics.

Strange things happen. I recall once discovering that all of a sudden I
could no longer create a data link. I finally traced it to the
installation of a new mouse. Once I substituted the Microsoft driver for
the Logitech driver, everything returned to normal. Now what does a mouse
driver have to do with data links? I think script blocking possibly has
more to do with CreateObject("O utlook.Applicat *ion") than mouse drivers
have to do with data links. I think you can use the CreateObject method in
VBScript.

"Siv" <ms**********@r emoveme.sivill. com> wrote in message
news:e0******** *****@TK2MSFTNG P11.phx.gbl...
William,
That's something I wouldn't have thought of. The user has McAfee
antivirus on her machine, and the other users have Sophos Antivirus, she
also runs MS Antispyware beta which they don't either as the Sophos suite
we have installed on the desktop machines covers both antivirus and
spyware threats.

Have you heard that McAfee does this??

Is it just the script blocking part or some other aspect of McAfee?

Thanks for your help, it gives me an avenue to pursue.
--
Siv
Martley, Near Worcester, UK.
"William LaMartin" <la******@tampa bay.rr.com> wrote in message
news:eq******** *******@TK2MSFT NGP14.phx.gbl.. .
I have read that the script blockers in Antivirus programs may block
calls to CreateObject("O utlook.Applicat *ion"). I know Norton Antivirus
has such a script blocker, for example. I did a quick Google search on
CreateObject ("Outlook.Appli cat*ion") and antivirus that produced some
interestin g messages.


Nov 21 '05 #5
Siv
William
I got the user to turn off "scriptstop per" in McAfee to see if the problem
went away, but it didn't. She also runs MS Anti Spyware so I turned that
off as well and still no good. (Wasn't too keen to have these things turned
off anyway so in some ways I am glad that they weren't the cause of the
problem!).

So the problem must be software and DLL related??
Unless anyone else knows what could be the problem.
--
Siv
Martley, Near Worcester, UK.
"William LaMartin" <la******@tampa bay.rr.com> wrote in message
news:ed******** ******@TK2MSFTN GP14.phx.gbl...
I haven't used McAfee in years. I am only familiar with Norton Antivirus.
I personally had to disable the script blocking in it to get various things
in Microsoft Word to work, possibly also to get Microsoft Document Imaging
to work. It has been several years, and I can't remember the specifics.

Strange things happen. I recall once discovering that all of a sudden I
could no longer create a data link. I finally traced it to the
installation of a new mouse. Once I substituted the Microsoft driver for
the Logitech driver, everything returned to normal. Now what does a mouse
driver have to do with data links? I think script blocking possibly has
more to do with CreateObject("O utlook.Applicat *ion") than mouse drivers
have to do with data links. I think you can use the CreateObject method in
VBScript.

"Siv" <ms**********@r emoveme.sivill. com> wrote in message
news:e0******** *****@TK2MSFTNG P11.phx.gbl...
William,
That's something I wouldn't have thought of. The user has McAfee
antivirus on her machine, and the other users have Sophos Antivirus, she
also runs MS Antispyware beta which they don't either as the Sophos suite
we have installed on the desktop machines covers both antivirus and
spyware threats.

Have you heard that McAfee does this??

Is it just the script blocking part or some other aspect of McAfee?

Thanks for your help, it gives me an avenue to pursue.
--
Siv
Martley, Near Worcester, UK.
"William LaMartin" <la******@tampa bay.rr.com> wrote in message
news:eq******** *******@TK2MSFT NGP14.phx.gbl.. .
I have read that the script blockers in Antivirus programs may block
calls to CreateObject("O utlook.Applicat *ion"). I know Norton Antivirus
has such a script blocker, for example. I did a quick Google search on
CreateObject ("Outlook.Appli cat*ion") and antivirus that produced some
interestin g messages.


Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1560
by: Jay | last post by:
Hi, I am using the MailMessage object to send mails. One issue that I am currently facing is that the 'From' address that I provide is not getting resolved. I was testing the code with the same address for both 'From' and 'To'. When I viewed the mail through Outlook, the 'To' address was resolved and I was able to view the Outlook properties, but not the 'From'. The 'From' address was displayed like an external SMTP type email ID. ...
3
1309
by: Andrew J | last post by:
Hi all Would really appreciate if someone can help mi with a problem I've been having with ASP generated emails. In fact, this might be a question more related to Outlook than ASP, but in any case I would appreciate if someone could help me to resolve it. This is what happens - I have a simple little Order form on our Intranet site which is filled out by our employees (who are logged on to the local network) and once submitted, the ASP...
5
2448
by: Mike | last post by:
I am creating both a text and html version of the same newsletter and sending using CDOSYS. Both of them incorporate a list of stories drawn from a database which are assigned to a variable storyloop. The text version works fine, but partway throught the html version when viewed in Outlook 2000, it goes wrong. View source shows nothing obviously wrong, except that partway through the storyloop, it just stops and then goes onto the...
1
1480
by: WillWeGetOurFreedomBack | last post by:
Here is the text of an email I recently received from a user of our Access 2K application. This is totally baffling to me. "WXYZ" = the name of our program for the purpose of this message. "What I did was I sent every email in my WXYZ to myself. Interestingly, most of the emails delivered. Out of 18, 6 wouldn’t deliver. I tried changing the subject verbiage and then it delivered to my inbox. Therefore, there’s an email filter...
3
2592
by: Prakash Wadhwani | last post by:
Hi !! I have been browsing around but have not been able to find a simple, lucid solution ... or maybe I'm just too confused. I know this has been asked before by many ... but pls bear with me. Step 1: I want to place a button which outputs my report as a snapshot to a specific folder. What is he VBA code to acomplish this ? Step2: I want to place a button which emails the above generated report using
9
1852
by: bobdydd | last post by:
Hullo Everybody I am trying to send a email from WITHIN Access 2000 with a report attached that is generated WITHIN Access in the normal way, but all the help examples I have seen uses an external file like C:\test.txt I have been using: DoCmd.SendObject acReport, stDocName, acFormatRTF, But when the message body is more than 70 characters long (random), it
1
6573
by: sxwend | last post by:
I am trying to use the following post results (http://www.thescripts.com/forum/thread189759.html) and add another requirement. I need to send the results to just the email addresses that the query specifies for each record... Essentially this is a make shift Ordering Tool and I want to be able to notify the receiver of the order and its specifics. q_Order_Detail_4email consists of ,,, and Example: Hello@mail.com,956,Modem,1000,xyz123...
1
1665
by: 1andy1 | last post by:
Hello, I have a following problem. Development environment Windows XP, VS 2008, Outlook 2003. Deployment environment Small bussiness server, Outlook 2000. I have created a small VB .Net program which forwards emails using Outlook application. This program is called from MS-SQL every 2 min. At the end of the program I close all the resources, but Outlook.exe process is still displayed in the Task manager. Here is the code I use for...
28
4433
tdw
by: tdw | last post by:
Hi all, I am trying to add a feature to our database that automates sending emails. When entering a new order, I want the option to send an email to the company the order came from, attaching a copy of our work order. The file that I want to attach is a rich text document created by Access and stored on our server. The creation of this document is not the problem. The problem is getting the email option to work. It does not seem to...
0
9521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9333
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9945
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.