Outlook automation limitations??

  • Thread starter Thread starter Lisa
  • Start date Start date
L

Lisa

I have an Access database which creates attachments and
then mails them out to users via Outlook. I have
everything working except the program needs to send out 47
and it stops at 33 (for one month) and another month stops
at 30 instead of the total 41. The program runs without
any errors.

Is there any restrictions on using office automation to
send emails through Outlook? Is there any sort of session
time out? Is there some sort of security setting that I
should know about?

I would welcome any answers on how to get this to send out
the total number. I can't seem to narrow down the
problem. Thanks in advance for your help.
 
There are no restrictions that would result in the symptoms you are seeing.
Perhaps you should post a code snippet that illustrates how you're creating
the messages.
 
Your ISP may have placed restrictions on the number of e-mails you can send
out in any time frame.

Regards
Sanjay Singh
---------------------------------------------------
Save time and Work Faster in Outlook 2000/XP
Download Addins to enhance your Outlook experience
http://www.addins4outlook.com

-----Original Message-----
 
Here is my code doing this automation. I hope this helps.

Private Sub cmdExport_Click()
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim olApp As New Outlook.Application
Dim olSpace As Outlook.NameSpace
Dim olMsg As Outlook.MailItem
Dim olAttach As Outlook.Attachment
Dim strSQL As String
Dim strFileName As String
Dim intExportCount As Integer

If Not IsNull(Me.cboMonth) Then
intExportCount = 0
strSQL = "SELECT BpnForm.BpnFormID,[OfficeID] &
[OfficeID4] AS FileName, [ID Requests].SubmitterEmail " & _
"FROM StatusTracking INNER JOIN ([ID
Requests] INNER JOIN BpnForm ON [ID Requests].RequestID =
BpnForm.RequestID) ON StatusTracking.RequestID =
BpnForm.RequestID " & _
"WHERE (((Format([ExpirationDate],'mmmm'))='"
& Me.cboMonth & "'));"

Set cnn = CurrentProject.Connection
rs.Open strSQL, cnn, adOpenStatic
Set olSpace = olApp.GetNamespace("MAPI")
olSpace.Logon FMPRG, "", False, False
With rs
If Not (.EOF And .BOF) Then
.MoveFirst
Do While Not .EOF
glngIDForExport = .Fields(0)
strFileName = "D:\" & .Fields(1) & ".xls"
DoCmd.OutputTo
acOutputQuery, "qry_Export", acFormatXLS, strFileName
formatfile (strFileName)
Set olMsg = olApp.CreateItem(olMailItem)
olMsg.To = .Fields(2)
olMsg.Subject = "Registration
Recertification"
olMsg.Body = "Last test..." & vbCrLf &
vbCrLf & strFileName
olMsg.Importance = olImportanceHigh
Set olAttach = olMsg.Attachments.Add
(strFileName)
olMsg.Display
Set olAttach = Nothing
Set olMsg = Nothing
intExportCount = intExportCount + 1
.MoveNext
Loop
Select Case intExportCount
Case 1
MsgBox "Export Complete" & vbCrLf &
intExportCount & " Record Processed"
Case Else
MsgBox "Export Complete" & vbCrLf &
intExportCount & " Records Processed"
End Select
Else
MsgBox "No Records to Export"
End If
.Close
End With

Set rs = Nothing
cnn.Close
Set cnn = Nothing
Set olApp = Nothing

Else
MsgBox "Select Month Before Exporting"
End If

End Sub
 
Well, I'm stumped. If there are no errors, it looks like it should create a
message for each record.

Lisa said:
Here is my code doing this automation. I hope this helps.

Private Sub cmdExport_Click()
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim olApp As New Outlook.Application
Dim olSpace As Outlook.NameSpace
Dim olMsg As Outlook.MailItem
Dim olAttach As Outlook.Attachment
Dim strSQL As String
Dim strFileName As String
Dim intExportCount As Integer

If Not IsNull(Me.cboMonth) Then
intExportCount = 0
strSQL = "SELECT BpnForm.BpnFormID,[OfficeID] &
[OfficeID4] AS FileName, [ID Requests].SubmitterEmail " & _
"FROM StatusTracking INNER JOIN ([ID
Requests] INNER JOIN BpnForm ON [ID Requests].RequestID =
BpnForm.RequestID) ON StatusTracking.RequestID =
BpnForm.RequestID " & _
"WHERE (((Format([ExpirationDate],'mmmm'))='"
& Me.cboMonth & "'));"

Set cnn = CurrentProject.Connection
rs.Open strSQL, cnn, adOpenStatic
Set olSpace = olApp.GetNamespace("MAPI")
olSpace.Logon FMPRG, "", False, False
With rs
If Not (.EOF And .BOF) Then
.MoveFirst
Do While Not .EOF
glngIDForExport = .Fields(0)
strFileName = "D:\" & .Fields(1) & ".xls"
DoCmd.OutputTo
acOutputQuery, "qry_Export", acFormatXLS, strFileName
formatfile (strFileName)
Set olMsg = olApp.CreateItem(olMailItem)
olMsg.To = .Fields(2)
olMsg.Subject = "Registration
Recertification"
olMsg.Body = "Last test..." & vbCrLf &
vbCrLf & strFileName
olMsg.Importance = olImportanceHigh
Set olAttach = olMsg.Attachments.Add
(strFileName)
olMsg.Display
Set olAttach = Nothing
Set olMsg = Nothing
intExportCount = intExportCount + 1
.MoveNext
Loop
Select Case intExportCount
Case 1
MsgBox "Export Complete" & vbCrLf &
intExportCount & " Record Processed"
Case Else
MsgBox "Export Complete" & vbCrLf &
intExportCount & " Records Processed"
End Select
Else
MsgBox "No Records to Export"
End If
.Close
End With

Set rs = Nothing
cnn.Close
Set cnn = Nothing
Set olApp = Nothing

Else
MsgBox "Select Month Before Exporting"
End If

End Sub
-----Original Message-----
There are no restrictions that would result in the symptoms you are seeing.
Perhaps you should post a code snippet that illustrates how you're creating
the messages.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers






.
 
Back
Top