VBA Code to generate Outlook Reminder

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,595
Office Version
  1. 2021
Platform
  1. Windows
I have written code to send a reminder to outlook based on a date on Col C

I have dates and text In Col C

https://www.dropbox.com/s/sh4uinn570nd3ds/VBA Code to Generate Outlook Reminders.xlsm?dl=0



I need the code amended so that where there is either no date or text, the reminder is not send to outlook. Where there is text, it must send a reminder to the outlook calender on 1 July 2019 (I use format dd/mm/yyyy)

Code:
 Sub Outloook_Reminders()
Sheets("renewals").Select
     Dim startRow As Long, endRow As Long, ctr As Long
   
     startRow = 2
     endRow = Cells(Rows.Count, 1).End(xlUp).Row
     
     For ctr = startRow To endRow
        With CreateObject("Outlook.application").createitem(1)
        On Error Resume Next
            .Start = DateValue(Range("C" & ctr)) + TimeValue(Range("C" & ctr))
            .Duration = CLng(Range("D" & ctr)) ' 30
            .Subject = CStr(Range("E" & ctr)) ' subject text
            .ReminderSet = True
            .Save
        End With
     Next
End Sub


It would be appreciated if someone can kindly amend my code

I have also posted on link below


https://www.excelforum.com/excel-programming-vba-macros/1281158-vba-code-outlook-reminder.html
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I don't know if this will work but try something like this
Code:
Sub Outloook_Reminders()
Sheets("renewals").Select
     Dim startRow As Long, endRow As Long, ctr As Long
   
     startRow = 2
     endRow = Cells(Rows.Count, 1).End(xlUp).Row
     
     For ctr = startRow To endRow
        With CreateObject("Outlook.application").createitem(1)
        On Error Resume Next
	If Not Cells(Ctr, "C").Value is Nothing then
            	.Start = DateValue(Range("C" & ctr)) + TimeValue(Range("C" & ctr))
            	.Duration = CLng(Range("D" & ctr)) ' 30
            	.Subject = CStr(Range("E" & ctr)) ' subject text
            	.ReminderSet = True
            	.Save
	End If
        End With
     Next
End Sub

This will only check to see if there is any information in column C. Let me know if this works, I use similar coding in my stuff to check.
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

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