Outlook 2010

<pre style="color: #333333;background-color: #ffffcc;font-size: 12pt;font-family:Calibri">
  <span style='mso-spacerun:yes'>  </span>...
</pre>

— Me@2024-11-15 01:42:34 AM

.

.

2024.11.15 Friday (c) All rights reserved by ACHK

Sub ExportCalendarToOrgMode()

Sub ExportCalendarToOrgMode()
    Dim objFolder As Outlook.Folder
    Dim objAppointment As Outlook.AppointmentItem
    Dim strOutput As String
    Dim objFile As Object
    Dim strFilePath As String
    Dim totalAppointments As Integer

    strFilePath = "Z:\media\d\Outl.org"

    Set objFolder = Application.Session.GetDefaultFolder(olFolderCalendar)

    For Each objAppointment In objFolder.Items
        strOutput = strOutput & "* " & objAppointment.Subject & vbCrLf
        strOutput = strOutput & "SCHEDULED: <" & Format(objAppointment.Start, "yyyy-MM-dd>") & vbCrLf
        strOutput = strOutput & "DESCRIPTION: " & objAppointment.Body & vbCrLf
        strOutput = strOutput & vbCrLf

        totalAppointments = totalAppointments + 1
    Next objAppointment

    Set objFile = CreateObject( "Scripting.FileSystemObject" ).CreateTextFile(strFilePath, True)
    objFile.Write strOutput
    objFile.Close

    MsgBox "Calendar exported to: " & strFilePath & vbCrLf & "Total appointments exported: " & totalAppointments, vbInformation
End Sub

Sub ShiftCalendarEvents()
    Dim calFolder As Object
    Dim calItems As Object
    Dim calItem As Object
    Dim startDate As Date
    Dim endDate As Date
    Dim shiftDays As Integer

    shiftDays = 7

    ' 9 represents olFolderCalendar in Outlook 2010
    Set calFolder = Application.Session.GetDefaultFolder(9)

    Set calItems = calFolder.Items

    For Each calItem In calItems
        If calItem.Class = 26 Then ' 26 represents olAppointment in Outlook 2010
            calItem.Start = DateAdd("d", shiftDays, calItem.Start)
            calItem.Duration = 60
            calItem.Save
        End If
    Next calItem

    MsgBox "Calendar events have been shifted by " & shiftDays & " days."
End Sub

— Me@2024-09-14 12:47:16 PM

.

.

2024.09.15 Sunday (c) All rights reserved by ACHK