Email Reminders

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,595
Office Version
  1. 2021
Platform
  1. Windows
I have a workbook and have et up a macro to send a reminder to outlook, but get a run time error "type mismatch


The code below is highlighted

Code:
 .Start = DateValue(Range("D" & ctr)) + TimeValue(Range("D" & ctr))

See sample data and code below


It would be appreciated if someone could kindly amend my code






Book1
ABCDEFGHI
2No.BranchChassisReminder Due Date-10Due DateDue Date TimeDurationSubjectTime
31Br1AFD9507518/02/2018 08:0028/02/2018 00:0028/02/2018 08:0030AFD95075 is due on 28/02/201808:00
423008:00
533008:00
643008:00
Settlement Reminders
Cell Formulas
RangeFormula
B3=IF(Settle!L2="","",Settle!L2)


Code:
 Sub Reminders()
     Dim startRow As Long, endRow As Long, ctr As Long
   
     startRow = 3
     endRow = Cells(Rows.Count, 1).End(xlUp).Row
     
     For ctr = startRow To endRow
        With CreateObject("Outlook.application").CreateItem(1)
            .Start = DateValue(Range("D" & ctr)) + TimeValue(Range("D" & ctr))
            .Duration = CLng(Range("G" & ctr)) ' 30
            .Subject = CStr(Range("H" & ctr)) ' subject text
            .ReminderSet = True
            .Save
        End With
     Next
End Sub
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi howard,
I picked up and use this,,,
Code:
Option Explicit
Sub Reminders()
     Dim startRow As Long, endRow As Long, ctr As Long
   
    Dim olApp As Outlook.Application
    Dim olAppt As Outlook.AppointmentItem
    Dim blnCreated As Boolean
    Dim olNS As Outlook.Namespace
    Dim CalFolder As Outlook.MAPIFolder
    Dim intCount As Long
    On Error Resume Next
    Set olApp = Outlook.Application
    If olApp Is Nothing Then
        Set olApp = Outlook.Application
         blnCreated = True
        Err.Clear
    Else
        blnCreated = False
    End If
      On Error GoTo 0
    Set olNS = olApp.GetNamespace("MAPI")
    Set CalFolder = olNS.GetDefaultFolder(olFolderCalendar)
    startRow = 3
   For ctr = startRow To endRow
  Set olAppt = CalFolder.Items.Add(olAppointmentItem)
    With olAppt
        .Start = DateValue(Range("D" & ctr)) + TimeValue(Range("D" & ctr))
       ' .End = ?????
        .Duration = CLng(Range("G" & ctr)) ' 30
        .Subject = CStr(Range("H" & ctr)) ' subject text
       ' .Location = ????
       ' .Body = ????
        .BusyStatus = olBusy
       ' .ReminderMinutesBeforeStart = ????
        .ReminderSet = True
       ' .Categories = ?????
        .Save
     End With
Next
   
    Set olNS = Nothing
    Set CalFolder = Nothing
    Set olAppt = Nothing
    Set olApp = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top