Consulting

Results 1 to 2 of 2

Thread: Sending MS Project task to Outlook as an appoitnment in a custom calendar

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,285
    Location
    I don't have project so I couldn't test this but you can loop through the code with F8 to see what needs fixing.
    Use it in a testing phase first.
    Sub Export_Selection_To_OL_Appointments()
        ' project variables
        ' I used object because I don't have project
        Dim myTask As Object
        ' outlook variables
        Dim myOLApp As Object    
        Dim Ns As Object
        Dim folder As Object
        Dim appt As Object        
        ' setting up outlook for appointment in shared calendar
        ' myOLApp = outlook
        ' ns = outlooknamespace environment
        Set myOLApp = CreateObject("Outlook.Application")
        Set Ns = myOLApp.GetNamespace("MAPI")
        ' the shared calendar is part of your default calendar = folder of folder
        ' B2A Projects Calendar = name of shared calendar ?
        Set folder = Ns.GetDefaultFolder(olFolderCalendar).Folders("B2A Projects Calendar")
        ' appointment should be added to shared calendar
        ' so for every task in your selection we make an appointment in shared calendar
        For Each myTask In activeselection.Tasks
            Set appt = folder.items.Add
            With appt
                .Start = myTask.Start
                .End = myTask.Finish
                .Subject = " Rangebank PS " & myTask.Name
                .Categories = myTask.Project
                .Body = myTask.Notes
                .Display 'or .Save
            End With
            'clear the appt variable to accept new values for next myTask
            Set appt = Nothing
        Next myTask
        ' clear up variables
        myOLApp = Nothing
    End Sub
    Charlize
    Last edited by Aussiebear; 02-14-2025 at 12:38 PM.

Posting Permissions

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