Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

E-Mailing with MS Outlook 2000 Automatically

0 views
Skip to first unread message

Bill Njarheim

unread,
Jul 12, 2001, 1:01:03 PM7/12/01
to
Hello:

My collegue and I (more like my collegue) has found a bit of code that will
allow me to automatically send an e-mail from MS Access 2000, using the
Outlook. However, Outlook is generating a prompt when doing so. Below is
the code being used.

Public Function SendCustomers()

Dim DB As Database, oOutlookApp As Outlook.Application, LS_Filename As
String
Dim oMailItem As Outlook.mailitem, oAttachments As Outlook.Attachments

Set oOutlookApp = New Outlook.Application
Set oMailItem = oOutlookApp.CreateItem(olMailItem)
Set oAttachments = oMailItem.Attachments

Set DB = CurrentDb()

LS_Filename = "<File path and File name>"
DoCmd.TransferText acExportDelim, , "<Access Data>", LS_Filename & ".TXT",
True

LS_ShellCmd = "C:\WINNT\PKZIP.EXE " & LS_Filename & ".ZIP " & LS_Filename &
".TXT"

LD_Retval = Shell(LS_ShellCmd, vbHide)

oMailItem.To = "<Receipient>"
oMailItem.Subject = "Customer List"
oMailItem.Body = "Here is the latest Customer List."
oAttachments.Add "<File path and File Name>", olByValue, 1, "Customer List"
oMailItem.Send

Set oMailItem = Nothing
Set oOutlookApp = Nothing

End Function

That is the basic concept of what I am trying to do. What is puzzling me,
is that Outlook is generating the following prompt...

A program is trying to automatically send e-mail on your behalf;
Do you want to allow this?

If this is unexpected, it may be a virus and you should choose "No".


It then displays a progress bar for a fleeting few seconds and then enables
the "Yes" option once the progress bar is finished.

What I want is to not have this prompt come up at all and want the e-mail to
be sent through automatically.

Your help is appreciated.

Bill Njaheim

bnja...@hotmail.com

Thank you.


Ken Slovak - [MVP - Outlook]

unread,
Jul 12, 2001, 1:14:03 PM7/12/01
to
That prompt is the result of the security model for Outlook 2000 SP2
and Outlook 2002. If you are using Exchange you can use the security
admin form to allow the Send action and other actions or properties
that are affected. The other ways to avoid the prompt are to code in
Extended MAPI or to use Outlook Redemption (www.dimastr.com)

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Co-author of "Programming Microsoft Outlook 2000", Chapters 8-13,
Appendices, Sams


"Bill Njarheim" <bnja...@hotmail.com> wrote in message
news:jJk37.25332$E93.4...@news1.telusplanet.net...

Sue Mosher

unread,
Jul 12, 2001, 1:16:17 PM7/12/01
to
If you're a standalone user, you can't disable the security dialogs that pop
up when an application tries to access certain Outlook properties and
methods. See http://www.slipstick.com/outlook/esecup.htm#autosec

If you're the administrator in an Exchange Server or HP OpenMail
environment, you can reduce the impact of the security prompts with
administrative tools. See http://www.slipstick.com/outlook/esecup/admin.htm.

If it's an application you wrote yourself, you can use one of these two
approaches to redo the program:

-- Use Extended MAPI (see http://www.slipstick.com/dev/mapi.htm) and C++
or Delphi

-- Use Redemption (http://www.dimastr.com/redemption/)

--

Sue Mosher, Outlook MVP
Author of
Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours
Microsoft Outlook 2000 E-mail and Fax Guide
Outlook and Exchange solutions at http://www.slipstick.com


"Bill Njarheim" <bnja...@hotmail.com> wrote in message
news:jJk37.25332$E93.4...@news1.telusplanet.net...

0 new messages