2 QUESTIONS - DATE SEARCH AND OUTLOOK CALENDER

nick_rubingh

New Member
Joined
Sep 1, 2023
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I am very new and very inexperienced, I hope someone can help me. I have 2 questions see below first one:
I want to find duplicate dates for my database, but not working. I want to show how many duplicates too.

Private Sub Textbox3_afterupdate()
Set rng = Range("E2:E3000")

Dim ws As Worksheet
Dim sToFind As String
Dim rFind As Range
Dim lr As Long 'last used rown in column BL



Set ws = Sheets("Database")
sToFind = DateValue(TextBox3.Text)

lr = ws.Range("E" & Rows.Count).End(xlUp).Row

Set rFind = ws.Range("E2:E" & lr).Find(sToFind)

If rFind Is Nothing Then
'No match
MsgBox "Geen andere aanvragen gevonden op" & Space(1) & TextBox3.Value, vbQuestion, Title:="IATA CORENDON"
Else
'Match Found
MsgBox "Andere aanvragen gevonden op :" & Space(1) & TextBox3.Value, vbQuestion, Title:="IATA CORENDON"
End If
End Sub


Also how should I add calender outlook appointments to my agenda with the date of textbox3 minus 42 days.

Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Database") 'define your sheet!

Dim olApp As Object 'create outlook application
Set olApp = CreateObject("Outlook.Application")

Dim olNS As Object 'get namespace
Set olNS = olApp.GetNamespace("MAPI")

'define constants if using late binding
Const olFolderCalendar As Long = 9
Const olAppointmentItem As Long = 1

Dim olRecItems As Object 'get all appointments
Set olRecItems = olNS.GetDefaultFolder(olFolderCalendar)

Dim strFilter As String 'filter for appointments
Dim olFilterRecItems As Object 'filtered appointments


With olApp.CreateItem(olAppointmentItem)
.Subject = TextBox2.Value & Space(1) & "aanvraag verwerken in casab" & Space(1) & "vertrek" & Space(1) & TextBox3.Value
.Start = Textbox3. Value - 42
.Body = "VOER GEGEVENS IN VIA" & Chr(10) & TextBox11.Value
.AllDayEvent = True
.BusyStatus = 5
.ReminderSet = True
.Save
End With
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,224,816
Messages
6,181,141
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