Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Previously Working Code Falling Over After slight modification

$
0
0

Hi All

I have an issue with a piece of code that was working previously.  what I have is that initially I consolidated multiple projects plans into a master plan whilst retaining links and my extract to Excel worked fine.  However I modified my code to consolidate individual projects plans into an Excel worksheet but this time without retaining the link and it now fails.  There are 1496 tasks in the consolidated plan and it falls over at the end of the first inserted Project.  Here3 is the code:

'Export GIVE and GET Milestones
    Row = 1
    For Each t In ActiveProject.Tasks
            If t.Flag10 = "True" Then                       'Flag10 is Deliverable Yes/No
                Set s = xlApp.ActiveWorkbook.Worksheets(1)
                Set xlRng = s.Range("A3")
                If Not t Is Nothing Then
                    With xlRng
                        .Range("A" & Row) = t.Text16
                        .Range("B" & Row) = t.Text12
                        .Range("C" & Row) = t.Text4
                        .Range("D" & Row) = t.Name
                        .Range("E" & Row) = t.PercentComplete
                        .Range("F" & Row) = t.Finish
                    End With
                End If
                If t.Flag10 = "True" Then
                    Row = Row + 1
                End If
            End If
        Set xlRng = xlRng.Offset(1, 0)  'Point to next row
    Next t

The line it falls over on is :

            If t.Flag10 = "True" Then                       'Flag10 is Deliverable Yes/No

Any help/advice would be appreciated.

Kind regards

Tony


TKHussar


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>