VBA Code to generate Outlook Reminder

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,603
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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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