none
Export Timephased Data to Excel RRS feed

  • Question

  • Hi

    I am trying to use some code found on the web for exporting TimePhasedData to Excel but it is alling over on the second "Set tsvs" line with an error message:

    Runtime error "1101"

    The argument value is not valid. 

    The code is:

    Sub TimePhasedDataTest() 
    Dim tsv As TimeScaleValue 
    Dim tsvs As TimeScaleValues 
       'Timephased for Task with a UniqueID of 1 
       Set tsvs = ActiveProject.Tasks(1).TimeScaleData( _ 
          StartDate:=ActiveProject.ProjectStart, _ 
          EndDate:=ActiveProject.ProjectFinish, _ 
          Type:=pjTaskTimescaledWork, _ 
          TimeScaleUnit:=pjTimescaleDays, Count:=1) 
       For Each tsv In tsvs 
          Debug.Print "Start: " & Format(tsv.StartDate, _ 
             "Long Date"), "Work: " & Val(tsv.Value) / 60 & "h" 
       Next tsv 
       Debug.Print 'Blank line 
       'Timephased for Resource "Res" 
       Set tsvs = ActiveProject.Resources("Res").TimeScaleData( _ 
            StartDate:=ActiveProject.ProjectStart, _ 
          EndDate:=ActiveProject.ProjectFinish, _ 
          Type:=pjResourceTimescaledWork, _ 
          TimeScaleUnit:=pjTimescaleDays, Count:=1) 
       For Each tsv In tsvs 
          Debug.Print "Start: " & Format(tsv.StartDate, _ 
             "Long Date"), "Work: " & Val(tsv.Value) / 60 & "h" 
       Next tsv 
    End Sub

    Any ideas anyone?

    Thanks in advance.

    Tony


    TKHussar

    Friday, January 9, 2015 1:33 PM

Answers

  • So did you get the solution now?

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by TKHussar Friday, January 30, 2015 1:14 PM
    Tuesday, January 13, 2015 5:31 AM
    Moderator

All replies

  • Hi Tony,

    Could you please firstly debug this code snippet and add watch on the variables? Please check if these variables has valid value:

    1. ActiveProject.Resources("Res")

    2. ActiveProject.ProjectStart

    3. ActiveProject.ProjectFinish

    Also check the documents for reference here:

    Resource.TimeScaleData Method (Project)

    By the way, for MSProject questions please access this link for dedicated support channel:

    https://support.microsoft.com/ph/931?wa=wsignin1.0


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, January 12, 2015 7:16 AM
    Moderator
  • Hi Caillen

    Many thanks for your response.

    The ActiveProject.Resources("Res") variable is never populated when the routine is run.

    It appeared to work when I ran it on an individual plan but no longer runs.  I was originally trying to run it on a consolidated plan without links to the sub projects.

    Kind regards

    Tony



    • Marked as answer by TKHussar Monday, January 12, 2015 10:50 AM
    • Edited by TKHussar Monday, January 12, 2015 1:31 PM
    • Unmarked as answer by TKHussar Monday, January 12, 2015 4:56 PM
    Monday, January 12, 2015 10:33 AM
  • So did you get the solution now?

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by TKHussar Friday, January 30, 2015 1:14 PM
    Tuesday, January 13, 2015 5:31 AM
    Moderator