I have developed a tracking register for complaints and had it working well with automated email function, I modified to to include another reminder and now I keep getting an error 6 overflow.
Can someone please provide advice?
I have developed a tracking register for complaints and had it working well with automated email function, I modified to to include another reminder and now I keep getting an error 6 overflow.
Can someone please provide advice?
Hello tekapo,
Welcome to the Forum!
You keep recreating the Outlook Application. You only need to create the Outlook Application at the very beginning of the code.
![]()
Private Sub SendReminderButton_Click() Dim OutlookApp As Object Dim RowNo As Integer RowNo = 4 Set OutlookApp = CreateObject("Outlook.Application") Do Until Worksheets("SWR DS Complaints Register").Cells(RowNo, 1).Value = "" + Worksheets("SWR DS Complaints Register").Cells(RowNo, 2).Value = "" If Worksheets("SWR DS Complaints Register").Cells(RowNo, 13).Value = "Overdue" Then With OutlookApp.CreateItem(olMailItem) .Subject = "OVERDUE COMPLAINT: " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 1).Value + Worksheets("SWR DS Complaints Register").Cells(RowNo, 2).Value .Body = "Regional Records indicate that the following Complaint from: " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 4).Value & " regarding " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 8).Value & " is currently overdue. Please action accordingly and provide the Regional Coordinatation Team with an update as soon as possible." .To = Worksheets("SWR DS Complaints Register").Cells(RowNo, 16).Value .Send End With Else If Worksheets("SWR DS Complaints Register").Cells(RowNo, 13).Value = "On Schedule" Then With OutlookApp.CreateItem(olMailItem) .Subject = " OUTSTANDING COMPLAINT: " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 1).Value + Worksheets("SWR DS Complaints Register").Cells(RowNo, 2).Value .Body = "Regional Records indicate that the following Complaint from: " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 4).Value & " regarding " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 8).Value & " has not been completed. Please action accordingly and provide the Regional Coordinatation Team with an update as soon as possible." .To = Worksheets("SWR DS Complaints Register").Cells(RowNo, 16).Value .Send End With Else If Worksheets("SWR DS Complaints Register").Cells(RowNo, 13).Value = "Recommendations" Then With OutlookApp.CreateItem(olMailItem) .Subject = " OUTSTANDING RECOMMENDATIONS OF COMPLAINT: " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 1).Value + Worksheets("SWR DS Complaints Register").Cells(RowNo, 2).Value .Body = "Regional Records indicate that the required recommendations of the Complaint from: " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 4).Value & " regarding " & Worksheets("SWR DS Complaints Register").Cells(RowNo, 8).Value & " have not been completed. Please action accordingly and provide the Regional Coordinatation Team with an update on the recommended improvement actions as soon as possible." .To = Worksheets("SWR DS Complaints Register").Cells(RowNo, 16).Value .Send End With End If End If End If RowNo = RowNo + 1 Loop End Sub
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Another point regards Overflow errors in general...
When storing Row numbers in Variables it is always advisable to use a Long Type variable given Row boundaries exceed those of the Integer type.
In VBA there's a general consensus that the Integer type is of very limited use given all Integers are in fact converted to Longs (and subsequently back to Integer) behind the scenes.
On that basis most would say - just use Longs
(or Byte if you know the value is going to be within Byte boundaries)
Integer is useful if you want to deliberately generate an Overflow Debug but I would say that's an unlikely scenario (given you can just sanity check the value of the Long)
Last edited by DonkeyOte; 10-03-2010 at 06:30 AM. Reason: reworded
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks