0% found this document useful (0 votes)
4 views3 pages

Sub Schedulet

vtvvh bj

Uploaded by

smrzahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Sub Schedulet

vtvvh bj

Uploaded by

smrzahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Sub Schedule_meeting()

On Error GoTo errlbl

Dim ws As Worksheet

Dim objOApp As Outlook.Application

Dim oAccount As Outlook.Account

Dim objAppt As Outlook.AppointmentItem

Dim i As Long

Dim usrName As String

sendmails = MsgBox("Send Mails?", vbYesNo, "Send Mails")

Set objOApp = CreateObject("Outlook.Application")

Set objAppt = objOApp.CreateItem(olAppointmentItem)

Set ws = ThisWorkbook.Sheets("Mailer")

i=2

usrName = Environ("Username")

If sendmails = vbYes Then

While ws.Cells(i, 1) <> ""

If ThisWorkbook.Sheets("Interview Details").Cells(i, 18) <> "Invite Sent" Then

If ws.Cells(i, 3) <> "" Then

Set objAppt = objOApp.CreateItem(olAppointmentItem)

Set oAccount = objAppt.Session.Accounts.Item(1)

oAccount.Session.Logon

With objAppt

.RequiredAttendees = ws.Cells(i, 3)

.Subject = ws.Cells(i, 4)

.Start = ws.Cells(i, 21)

.End = ws.Cells(i, 22)


.Location = ws.Cells(i, 5) & ws.Cells(i, 8)

.Body = ws.Cells(i, 10) & usrName & vbNewLine & "Internal Loops Scheduling Team" &
vbNewLine & "ES - Recr Svc"

.Sensitivity = olPrivate

.MeetingStatus = 1

.ResponseRequested = True

.SendUsingAccount = oAccount

.Send

End With

End If

ThisWorkbook.Sheets("Interview Details").Cells(i, 18) = "Invite Sent"

ThisWorkbook.Sheets("Interview Details").Cells(i, 19) = Format(Now(), "mm/dd/yyyy hh:mm")

End If

i=i+1

Wend

objOApp.Session.Logoff

Set objOApp = Nothing

Exit Sub

errlbl:

MsgBox Err.Description

End If

End Sub

'Private Sub Workbook_Open()

'Dim ws As Worksheet

'Dim lRow As Long

'
'Set ws = ThisWorkbook.Sheets("Mailer")

'

'lRow = ws.Cells(Rows.Count, 17).End(xlUp).Row

'

'If lRow > 2 Then

' Range("Q3:Q" & lRow).ClearContents

'End If

'

'End Sub

You might also like