Hi thanks for that it runs and then after 15 minutes it execute the cndstart button but then it throws out a variable not defined error âoleasMailItemâ but if I take the timer out and click the cmdstart button then the application runs fine with out errors.
Code:
Option Explicit
Dim MinCount As Integer
Private Sub cmdstart_Click()
If lblMsgA <= 1000 Then
Dim oleasApp As Outlook.Application
Set oleasApp = CreateObject("Outlook.Application")
Dim oleasNs As Outlook.Namespace
Set oleasNs = oleasApp.GetNamespace("MAPI")
oleasNs.Logon
Dim oleasMail As Outlook.MailItem
Set oleasMail = oleasApp.CreateItem(oleasMailItem)
oleasMail.To = [email protected]
oleasMail.Subject = "VB TEST"
oleasMail.Body = _
"Good Day Eason" & ", " & vbCr & vbCr & vbTab & _
"Please note that your credit is all most finish ." & ", " & vbCr & vbCr & vbTab & _
"Many Thanks"
oleasMail.Send
MsgBox "All done...", vbMsgBoxSetForeground
oleasNs.Logoff
Set oleasNs = Nothing
Set oleasMail = Nothing
Set oleasApp = Nothing
End If
End Sub
Sub tmr_Minute_Timer()
MinCount = MinCount + 1
Label1.Caption = MinCount
If (MinCount = 15) Then
Call cmdstart_Click
MinCount = 0
End If
End Sub