Results 1 to 1 of 1

Excel macro - export to Outlook .ics

Threaded View

  1. #1
    Registered User
    Join Date
    02-04-2011
    Location
    Hunderup, Denmark
    MS-Off Ver
    Excel 2007/2010
    Posts
    2

    Smile Excel macro - export to Outlook .ics

    Hey!

    I have this macro in Excel which exports events to an .ics file that i can open with Outlook Calendar. It automaticly populates the calendar with information in the Excel document:

    Sub Generate_ICS()
        Dim rng1 As Range, X, i As Long, v As Long
        Dim objFSO, objFile
        Dim FilePath As String
        FilePath = "G:\Service vent - FILNAVNE MÅ IKKE ÆNDRES!\Service til kalender.ics"
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objFile = objFSO.CreateTextFile(FilePath)
        Set rng1 = Range([a5], 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

    It works perfectly however I wan't to do a few modifications to fit my needs. I know absolutely nothing about coding these macros, so I need someone to help me out.

    Additionally I wan't to:
    - Pick up dates from column 'H' instead of 'B'. (I've tried to just change B to H, but that didn't work)
    - Make the events all day events, so that the starting/ending time is not showed up in the calendar, but only the title/name.
    - Put in a reminder 1 week before.
    - Place all the events in a category.
    - Include additional information (more columns). I have a column for location info, aswell as a column for description. I wan't the macro to recognize these columns as location and description.

    I hope it's not too much of a trouble to make the modifications.


    Thanks!

    Best regards
    Jeppe C.
    Last edited by JeppeC; 02-04-2011 at 04:12 AM. Reason: Bad layout

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1