Este código serve para automatizarmos certas anotações que desejamos fiquem registradas para nossas lembranças posteriores. Isso pode ser feito dentro do MS Outlook, mas também pode ser executado fora dele em outras instancias.
Let strExcelPath = ""Const olAppointmentItem = 1Const olRecursWeekly = 1Set objExcel = CreateObject("Excel.Application")objExcel.WorkBooks.Open strExcelPathSet objSheet = objExcel.ActiveWorkbook.Worksheets(1)Let intRow = 3Do While objSheet.Cells(intRow, 1).Value <> ""Let strName = objSheet.Cells(intRow, 3).ValueLet strDate = objSheet.Cells(intRow, 4).ValueSet objOutlook = CreateObject("Outlook.Application")Set objAppointment = objOutlook.CreateItem(olAppointmentItem)Let strStart = strDate & "/2013 11:00 AM"Let strEnd = strDate & "/2099 11:00 AM"Let objAppointment.Start = strStartLet objAppointment.Duration = 30Let objAppointment.Subject = strName & " Event"Let objAppointment.Body = "Lembre-se, hoje você tem compromisso com " &strName& "' - Reunião de ..."Let objAppointment.Location = "Triumph Circle"Let objAppointment.ReminderMinutesBeforeStart = 15Let objAppointment.ReminderSet = TrueSet objRecurrence = objAppointment.GetRecurrencePatternLet objRecurrence.RecurrenceType = 5Let objRecurrence.PatternStartDate = strStartLet objRecurrence.PatternEndDate = strEndobjAppointment.SaveSet objRecurrence = nothingSet objAppointment = nothingSet objOutlook = nothingLet intRow = intRow + 1Loop' Close workbook and quit Excel.objExcel.ActiveWorkbook.CloseobjExcel.Application.Quit
set objSheet = nothingset objExcel = nothing
Reference:
Aditya Kalra
Inspiration:
André Luiz Bernardes
Tags: VBA, Excel, Outlook, automation, automate, appointment,
Nenhum comentário:
Postar um comentário