title: msproject control resource usage through VSTO
body: <p>I am trying to change the resource hours time phasing in the Resource Usage view by VB.NET/VSTO code.</p>
  
  <p>I have really basic code like this:</p>
  
  <pre><code>Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  
      Globals.ThisAddIn.Application.ActiveProject.Resources.UniqueID(1).TimeScaleData(StartDate:="13/03/18 00:00", EndDate:="14/03/18 00:00").Item(1).Value = "1"
  
  End Sub
  </code></pre>
  
  <p>When I try to run the code to test, I receive the following error message. Does anyone know how I can change this view programmatically, please?</p>
  
  <blockquote>
    <p>Error: System.Runtime.InteropServices.COMException: 'The argument
    value is not valid.'</p>
  </blockquote>