Is it possible to set reminder in outlook calendar when near due date using data from table

Auri

Board Regular
Joined
Apr 8, 2020
Messages
54
Office Version
  1. 2016
Platform
  1. Windows
I have found similar posts on this but they were not using the table. So I wonder if it's possible to set a reminder in the outlook calendar by taking data from the table like the expiry date and header itself, putting inside the calendar.

A total noob trying to learn this stuff, so I hope to have some help and or given solution to help me. Thanks!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
VBA Code:
Sub EnterInCalendar()
Dim xOutApp As Object, cel As Range, x%
Dim outNameSpace As Object
Dim outSharedName As Outlook.Recipient
Dim outCalendarFolder As MAPIFolder
Dim SharedMailboxEmail As String
    
If Selection.Columns.Count > 1 Or Selection.Column <> 3 Then
    MsgBox "Select in column C only."
    Exit Sub
End If

SharedMailboxEmail = "Insert Email here"

Set xOutApp = CreateObject("Outlook.Application")
Set outSharedName = outNameSpace.CreateRecipient(SharedMailboxEmail)
Set outCalendarFolder = outNameSpace.GetSharedDefaultFolder(outSharedName, olFolderCalendar)
Set outNameSpace = outApp.GetNamespace("MAPI")
 
For Each cel In Selection
    For x = 0 To 6
    With xOutApp.createitem(1)
        .Subject = cel.Value & " - " & cel(1, 4).Value
        .Start = cel(1, 4).Value - x + TimeValue("9:00:00")
        .End = cel(1, 4).Value - x + TimeValue("9:30:00")
        .ReminderSet = True
        .ReminderMinutesBeforeStart = 15
        .BusyStatus = 5
        .Save
    End With
    Next
Cells(cel.Row, "K") = "c"
Next
Set xOutApp = Nothing
End Sub

I tried adding some lines then running it which gotten me this error and it highlight on this line.
VBA Code:
Set outSharedName = outNameSpace.CreateRecipient(SharedMailboxEmail)
1587444711257.png
 
Upvote 0
I'm not able to test your code, but some comments :
• The line :
VBA Code:
Set outNameSpace = outApp.GetNamespace("MAPI")
Should probably be :
VBA Code:
Set outNameSpace = xOutApp.GetNamespace("MAPI")
• The line
VBA Code:
Set outNameSpace = xOutApp.GetNamespace("MAPI")
has to be before :
VBA Code:
Set outSharedName = outNameSpace.CreateRecipient(SharedMailboxEmail)
• What is : olFolderCalendar ?
 
Upvote 0
olFolderCalendar is The Calendar folder apparently. Not really how to use it though, I am just to extract some parts here and there I have seen.
 
Upvote 0
I'm not able to test your code, but some comments :
• The line :
VBA Code:
Set outNameSpace = outApp.GetNamespace("MAPI")
Should probably be :
VBA Code:
Set outNameSpace = xOutApp.GetNamespace("MAPI")
• The line
VBA Code:
Set outNameSpace = xOutApp.GetNamespace("MAPI")
has to be before :
VBA Code:
Set outSharedName = outNameSpace.CreateRecipient(SharedMailboxEmail)
• What is : olFolderCalendar ?

Okay, so here's the result. I tried changing to the one above and I removed this line
VBA Code:
Set outCalendarFolder = outNameSpace.GetSharedDefaultFolder(outSharedName, olFolderCalendar)
but I am not sure will it add to the group calendar since I am testing it using another email.
Once it's tested, will let you know. Thanks for the help!
 
Upvote 0
Okay apparently is not a shared calendar but rather to other recipients. I added in the emails of the recipients. Is there a way to take multiple of those emails from a single cell in that column and send an invitation or something similar to it?
 
Upvote 0
VBA Code:
Sub EnterInCalendar()
Dim xOutApp As Object, cel As Range
Dim olMailItm As Object
Dim iCounter As Integer
Dim Dest As Variant
Dim SDest As String

If Selection.Columns.Count > 1 Or Selection.Column <> 3 Then
    MsgBox "Select in column C only."
    Exit Sub
End If

Set xOutApp = CreateObject("Outlook.Application")
Set olMailItm = olApp.CreateItem(0) 'empty email

For Each cel In Selection
    With xOutApp.CreateItem(1)
        .Subject = cel.Value
        .Start = cel(1, 4).Value + TimeValue("9:00:00")
        .End = cel(1, 4).Value + TimeValue("9:30:00")
        .ReminderSet = True
        .ReminderMinutesBeforeStart = 10080
        .BusyStatus = 5
        .Save
    End With
    
    'Using the email, add multiple recipients, using a list of addresses in column J.
    With olMailItm
       SDest = ""
       For iCounter = 10 To WorksheetFunction.CountA(Columns(10))
           If SDest = "" Then
               SDest = Cells(iCounter, 10).Value
           Else
               SDest = SDest & ";" & Cells(iCounter, 10).Value
           End If
       Next iCounter
       'Do additional formatting on the BCC and Subject lines, add the body text from the spreadsheet, and send.
       .BCC = SDest
       .Subject = "FYI"
       .Body = ActiveSheet.TextBoxes(1).Text 'Not sure what this line does
       .Send
   End With
       
    Cells(cel.Row, "K") = "c"
Next

Set xOutApp = Nothing
Set olMailItm = Nothing
End Sub
Here's the code I have now, having error on
VBA Code:
Set olMailItm = olApp.CreateItem(0) 'empty email
this line which says object required.
Any help would be appreciated!
 
Upvote 0
Since this thread has morphed into a different question, I suggest you start a new thread.
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,545
Members
449,089
Latest member
davidcom

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