Created
September 3, 2011 20:03
-
-
Save andrewheiss/1191701 to your computer and use it in GitHub Desktop.
Convert a list of birthdays to a recurring iCal file (column A = event name; column B = date)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Generate_ICS() | |
Dim rng1 As Range, X, i As Long, v As Long | |
Dim objFSO, objFile | |
Dim FilePath As String | |
FilePath = "C:\output.ics" | |
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
Set objFile = objFSO.CreateTextFile(FilePath) | |
Set rng1 = Range([a2], Cells(Rows.Count, "B").End(xlUp)) | |
X = rng1 | |
objFile.write "BEGIN:VCALENDAR" & vbCrLf | |
For i = 1 To UBound(X, 1) | |
objFile.write "BEGIN:VEVENT" & vbCrLf & "DTSTART:" & Format(X(i, 2), "yyyymmdd") & vbCrLf & "DTEND:" & Format(X(i, 2), "yyyymmdd") & vbCrLf & "RRULE:FREQ=YEARLY" & _ | |
vbCrLf & "SUMMARY:" & X(i, 1) & vbCrLf & "END:VEVENT" & vbCrLf | |
Next i | |
objFile.write "END:VCALENDAR" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment