Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 11th, 2006, 02:56 PM
Authorized User
 
Join Date: Aug 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default E-mail using VBA and Outlook

I am using a Access mdb to send emails to others at my work. I am doing so my using the following code snippit

    Dim stDocName As String

    stDocName = "R_ESO"
    [All Signatures] = True

    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenReport stDocName, acViewPreview, , "[display ESO]= forms![f_ESO]![display eso]", acHidden
    DoCmd.SendObject acReport, stDocName, acFormatSNP, "Corinne Coates", , , "All signatures recived on ESO", , False

However, I always get a warning message
"A program is trying to automatically send e-mail on your behalf. Do you want to all this?
If this is unexpected, it maybe a virus and you should choose 'No'."

Any one have any ideas how to avoid the warning message?



Reply With Quote
  #2 (permalink)  
Old February 12th, 2006, 07:56 PM
Registered User
 
Join Date: Feb 2006
Location: Beverly, NJ, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Cybersurfer
Default

Does it say what program is giving you the message? Sounds like an Anti-Virus thing!! How many people are you sending to?

Thanks,

Rich
Reply With Quote
  #3 (permalink)  
Old February 13th, 2006, 12:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

The messages you are recieving are "normal" behavior imposed by the Outlook security patches when using Access with Outlook automation. To suppress them, download Outlook Redemption from http://www.dimastr.com/redemption/. The link provides extensive discussion of the Redemption object model and how to use Redemption objects in your code.

Bob


Reply With Quote
  #4 (permalink)  
Old February 13th, 2006, 01:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

I always use Outlook automation for e-mail apps, and don't know if your problem can be solved using DoCmd.SendObject, put if you're using automation this will help you get up to speed using Outlook Redemption.

You’ll download a zip file that contains the Redemption.dll. The .dll is a regular old COM library that you register on your system like any other:

Start --> Run --> Open: regsvr32.exe C:\WINDOWS\SYSTEM32\redemption.dll

Once registered, open the Access References dialog and look for a library named “SafeOutlookLibrary.” If you don’t see it, just browse to your WINDOWS\SYSTEM32 forder and select Redemption.dll.

Once you have a reference to the Redemption type library, you can use it’s objects and their members in your code. The .dll is listed in the Object Browser as “Redemption”.

The Redemption.SafeMailItem object will replace all the references in your code to the Outlook.MailItem object. This will allow you to bypass the Outlook Model Guard and its blocked properties which cause all the warning messages to display.

Code would look like this:
Code:
Public Function SendMail(strTo As String, _
   Optional strCC As String, _
   Optional strBCC As String, _
   Optional strSubject As String, _
   Optional strBody As String) As Boolean

   SendMail = False

   ' Set Outllok app and mailitem object variable.
   Dim objOutlookApp As Outlook.Application
   Dim objMailItem As Outlook.MailItem
   Set objOutlookApp = New Outlook.Application
   Set objMailItem = objOutlookApp.CreateItem(olMailItem)

   ' REDEMPTION OBJECTS: once you have your Outllook MailItem
   ' object allocated, save it as a Redemption.SafeMailItem
   ' object.
   Set objSafeMail = CreateObject("Redemption.SafeMailItem")
   objSafeMail.Item = objMailItem

   ' Add recipients to your Redemption.SafeMailItem
   ' recipients collection.
   Call objSafeMail.Recipients.Add(strTo)

   ' Assign subject line and message body, or other
   ' optinal arguments to your Redemption.SafeMailItem.
   objSafeMail.Subject = strSubject
   objSafeMail.Body = strBody

   ' Invoke the Redemption.SafeMailItem Send method.
   objSafeMail.Send

   'Destroy object variables.
   Set objMailItem = Nothing
   Set objOutlookApp = Nothing
   Set objSafeMail = Nothing

   SendMail = True

End Function

E-mails will be sent sans warning messages.

HTH,

Bob


Reply With Quote
  #5 (permalink)  
Old February 13th, 2006, 10:47 AM
Authorized User
 
Join Date: Aug 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Bob thanks for you thoughts. I have one dilemma with this. I have multiple users. They use there own computer system. In the past I have found the using a .dll would have to be installed on all computers. I don't think that is realistic. Any thoughts in regards to this?? Once again thank you so much for you thoughts.
Corinne

Reply With Quote
  #6 (permalink)  
Old February 13th, 2006, 10:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi Corinne,

Really can't add much, unfortunately. There are certainly a number of free tools out there that will let you run regsvr32.exe on a remote machine, but that doesn't sound like an option for you.

There are a few other (fairly arcane sounding) strategies for circumventing Outlook's "Object Model Gaurd", but I've never tried to implement any of them (other than Redemption). Several are listed about halfway down the following link:

http://www.outlookcode.com/d/sec.htm

Would love to know if you have any success with one or the other if you try one.

Bob

Reply With Quote
  #7 (permalink)  
Old December 4th, 2006, 11:07 AM
Registered User
 
Join Date: Nov 2006
Location: Bikaner, Rajasthan, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Bajrang
Default

Will RDO REmove the warning: " One programme is trying to access Emaill Address stored in your outlook address book."
Please let me know this.
Thanks in advance.

--------------------------------------------------

Quote:
quote:Originally posted by cc16
 I am using a Access mdb to send emails to others at my work. I am doing so my using the following code snippit

    Dim stDocName As String

    stDocName = "R_ESO"
    [All Signatures] = True

    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.OpenReport stDocName, acViewPreview, , "[display ESO]= forms![f_ESO]![display eso]", acHidden
    DoCmd.SendObject acReport, stDocName, acFormatSNP, "Corinne Coates", , , "All signatures recived on ESO", , False

However, I always get a warning message
"A program is trying to automatically send e-mail on your behalf. Do you want to all this?
If this is unexpected, it maybe a virus and you should choose 'No'."

Any one have any ideas how to avoid the warning message?



Bajrang
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Receiving mail with Outlook 2000 VBA spotts-71 All Other Wrox Books 3 August 24th, 2004 10:41 AM
Send mail NOT via Outlook Mitch Access 8 March 22nd, 2004 06:17 AM
wanna know how to see if i have new outlook mail Haroldd Classic ASP Basics 3 November 21st, 2003 02:31 PM
Receiving mail with Outlook 2000 VBA spotts-71 Pro VB 6 7 July 17th, 2003 03:04 PM
Outlook 2000 VBA - Receive mail... spotts-71 VB How-To 2 July 17th, 2003 02:56 PM



All times are GMT -4. The time now is 08:52 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.