?
Solved

Outlook Warning from VBA

Posted on 2011-10-26
3
Medium Priority
?
245 Views
Last Modified: 2012-05-12
I have automated a system to do auto emails when orders are being received in Access.  When it tries to auto download, I get this message.  The process needs to run at all times, and even in the night when someone can't "Allow".  How do I get around this message from Access code?
outlook-message.gif
0
Comment
Question by:sharpapproach
  • 2
3 Comments
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 37032315
This is the notorious Object Model Guardian, which fortunately has been removed from recent versions of Office.  To get around it, you can install and use the Redemption Library, available from this Website:  www.dimastr.com.  Here is some sample VBA code using Redemption objects instead of regular Outlook objects.  

For more information on Redemption Libary, see my Access Archon article on the topic, which can be downloaded from this link:

http://www.helenfeddema.com/Files/accarch113.zip

Alternatively, you can just upgrade to Office 2010, and this obnoxious security feature will go away.


'Redemption objects and corresponding Outlook objects must
   'be declared as Object type
   Dim omsg As Object
   Dim msg As Object
   Dim otsk As Object
   Dim tsk As Object
   
      'Create new mail message and send it now
      Call OpenOutlook
      Set omsg = gappOutlook.CreateItem(olMailItem)
      Set msg = New Redemption.SafeMailItem
      msg.Item = omsg
      
      With msg
         .To = strToEMail
         .Subject = strMessageSubject
         .Body = strBody
         .Send
      End With
      
      'Note:  Messages created with Redemption Library objects
      'are created in the Drafts folder instead of the Outbox,
      'but they will be sent as if from the Outbox.
   Else
      'Create task item for sending the mail message later
      Set otsk = gappOutlook.CreateItem(olTaskItem)
      Set tsk = New Redemption.SafeTaskItem
      strTaskMessage = "When the task reminder fires, an email message will " _
         & "be created and placed in the Drafts folder to be sent"
      With tsk
         .Item = otsk
         .Display
         .Subject = strTaskSubject
         .DueDate = dteReminder
         .StartDate = dteReminder
         .Categories = "Reminder"
         .Body = strTaskMessage
         
         'Store info for mail message in unused Task fields
         .BillingInformation = strToEMail
         .CardData = strMessageSubject
         .Mileage = strBody
         
         'Set task reminder for date when message should be sent
         .ReminderSet = True
         .ReminderTime = dteReminder
         .Close (olSave)
      End With
   End If

      Set onitm = fldClientsStoreID.Items(1)
	'There is no SafeNoteItem, but SafeMailItem can be used for note items
      Set nitm = New Redemption.SafeMailItem
      nitm.Item = onitm

      Set jitm = New Redemption.SafeJournalItem
      jitm.Item = ojitm

Open in new window

0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 37032472
This will take care of that as well:
http://www.contextmagic.com/express-clickyes/

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37032478
Note that there are many other Utilities that will do this with out referencing Outlook...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question