MSProject addin create an 1101 error when run on MSP2016, but works fine with MSP2010


  • Hi,

    I use an addin to send my task information from MSProject to the Clarity.

    my MSProject Addin is working properly when I use MSProject2010, Clarity v15 and Clarity PPM Addin v14.

    When I switch to different environment (MSP2016, Clarity v15 and Clarity PPM Addin v 15, subroutine (below) returns an 1101 error. It is strange, because errors is generated in different lines of this subroutine even the same Project file is used.

    This subroutine is rather simple, it  rewrite the MSProject values to the Clarity buffer.

    All MSGboxes are temporary fot debugging  (except the last one)

    Any ideas about the reason?

    Private Sub AllignTasks(ByRef iLocalTask As MSProject.Task, ByRef iClarityTask As MSProject.Task)

            Dim vShortName As String
            Dim vMilestoneTag As String
            Dim vTaskNameLength As Integer

            Dim vFlag As Boolean

            vFlag = False

            On Error GoTo ErrHandler
            MessageBox.Show("sTART date= " & iLocalTask.Start & vbLf & "Start date Baseline= = " & iLocalTask.BaselineStart & vbLf _
                            & "Finish Baseline= " & iLocalTask.BaselineFinish, RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            If Len(iLocalTask.Name) > 150 Then
                vMilestoneTag = GetMilestoneOrObjectiveTag(iLocalTask.Name)
                vTaskNameLength = 146 - Len(vMilestoneTag)
                vShortName = Left(iLocalTask.Name, vTaskNameLength) & "... " & vMilestoneTag
                iClarityTask.Name = vShortName
                iClarityTask.Name = iLocalTask.Name
            End If

            MessageBox.Show("After Task Name", RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            MessageBox.Show("After UnlinkPredecessors", RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)
            MessageBox.Show("After UnlinkSuccessors", RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)
            iClarityTask.Manual = True
            MessageBox.Show("After Manual", RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)
            iClarityTask.Milestone = True
            MessageBox.Show("After Milestone", RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            ' to mark that the task is used to store milestone info at the level 1 rather than a project.
            vFlag = True
            '  iClarityTask.Flag20 = vFlag                 'True

            MessageBox.Show("After Flag20= " & iClarityTask.Flag20, RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            If iLocalTask.Text9 = "M/CS" Then
                If IsDate(iLocalTask.Start) Then
                    iClarityTask.Start = iLocalTask.Start
                    iClarityTask.Duration = 0
                    'iClarityTask.Finish = iLocalTask.Start
                    If IsDate(iLocalTask.BaselineStart) Then
                        iClarityTask.BaselineStart = iLocalTask.BaselineStart
                        iClarityTask.BaselineFinish = iLocalTask.BaselineStart
                    End If
                End If
                If IsDate(iLocalTask.Finish) Then

                    iClarityTask.Start = iLocalTask.Finish
                    iClarityTask.Duration = 0
                    'iClarityTask.Finish = iLocalTask.Finish
                    If IsDate(iLocalTask.BaselineFinish) Then
                        iClarityTask.BaselineStart = iLocalTask.BaselineFinish
                        iClarityTask.BaselineFinish = iLocalTask.BaselineFinish
                    End If
                End If
            End If
            MessageBox.Show("After M/CS; Text1= " & iLocalTask.Text1 & "; Text9= " & iLocalTask.Text9, RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            ' clarity key task seting it for new tasks

            'iClarityTask.Flag1 = vFlag                   'True
            MessageBox.Show("After Flag1= " & iClarityTask.Flag1, RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            iClarityTask.Text1 = iLocalTask.Text1
            MessageBox.Show("After Text1= " & iClarityTask.Text1, RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            iClarityTask.Text9 = iLocalTask.Text9

            MessageBox.Show("After Text9= " & iClarityTask.Text9, RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            If iLocalTask.PercentComplete = 100 And IsDate(iLocalTask.ActualFinish) Then
                iClarityTask.ActualFinish = iLocalTask.ActualFinish
            End If

            MessageBox.Show("After Percent Complete", RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK)

            Exit Sub

            Dim msgStr As String
            msgStr = "Error encountered when uploading local task to Clarity in AllignTasks sub at: " & vbLf
            If Not iClarityTask Is Nothing Then msgStr = "Clarity Task in AllignTasks sub " & iClarityTask.Name & vbLf
            If Not iLocalTask Is Nothing Then msgStr = "Local Task in AllignTasks sub " & iLocalTask.Name & vbLf
            msgStr = msgStr & Err.Description & " (#" & Err.Number & ") at " & vbLf

            MessageBox.Show(msgStr, RUN_CLARITY_UPLOAD_MSGBOX_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Sub

    Best regards

    Maciej Majkowski


    Jumat, 14 September 2018 14.29