J
JDMAWoods
I've been having trouble for about the past 4 months with the following code
which "should" (because it use to work) open up the specified Outlook profile
programattically. However, something has changed that I cannot pinpoint
which prevents the code from proceeding past the line...
objOutlook = CreateObject("Outlook.Application")
At this point, the profile dialog box opens and waits for user interaction
to proceed. It did not use to occur that way. Is there some registry key I
need to change, or what setting am I missing?
Option Compare Database
Option Explicit
' Variable that holds the name of the mailbox to use
Const MailboxName = "Mailbox - ME"
Const otlProfileName = "MYMail"
Function otlEMailGeneralUse()
On Error GoTo otlEMailGeneralUse_Err
Dim db As Database
Dim rst As Recordset
Dim objNamespace As NameSpace
Dim MAILFolder As MAPIFolder
Dim DIFolder As MAPIFolder
Dim itms As Object
Dim itm As Object
Dim Sign As Property
Dim objOutlook As Outlook.Application
Dim RecCount As Integer
' Open Access query containing data to export to Outlook
Set db = DBEngine.Workspaces(0).Databases(0)
Set rst = db.OpenRecordset("qrySEND-EMAIL")
RecCount = rst.RecordCount
If RecCount = 0 Then
Exit Function
End If
' Open the Outlook Inbox and create a message for each
' Person in the Access query to receive the email
' Check settings in Global Entries at top of Module for details.
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon otlProfileName, "", True, True
Set MAILFolder = objNamespace.Folders(MailboxName).Folders("Inbox")
Set DIFolder = objNamespace.Folders(MailboxName).Folders("Deleted Items")
Set itms = MAILFolder.Items
which "should" (because it use to work) open up the specified Outlook profile
programattically. However, something has changed that I cannot pinpoint
which prevents the code from proceeding past the line...
objOutlook = CreateObject("Outlook.Application")
At this point, the profile dialog box opens and waits for user interaction
to proceed. It did not use to occur that way. Is there some registry key I
need to change, or what setting am I missing?
Option Compare Database
Option Explicit
' Variable that holds the name of the mailbox to use
Const MailboxName = "Mailbox - ME"
Const otlProfileName = "MYMail"
Function otlEMailGeneralUse()
On Error GoTo otlEMailGeneralUse_Err
Dim db As Database
Dim rst As Recordset
Dim objNamespace As NameSpace
Dim MAILFolder As MAPIFolder
Dim DIFolder As MAPIFolder
Dim itms As Object
Dim itm As Object
Dim Sign As Property
Dim objOutlook As Outlook.Application
Dim RecCount As Integer
' Open Access query containing data to export to Outlook
Set db = DBEngine.Workspaces(0).Databases(0)
Set rst = db.OpenRecordset("qrySEND-EMAIL")
RecCount = rst.RecordCount
If RecCount = 0 Then
Exit Function
End If
' Open the Outlook Inbox and create a message for each
' Person in the Access query to receive the email
' Check settings in Global Entries at top of Module for details.
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon otlProfileName, "", True, True
Set MAILFolder = objNamespace.Folders(MailboxName).Folders("Inbox")
Set DIFolder = objNamespace.Folders(MailboxName).Folders("Deleted Items")
Set itms = MAILFolder.Items