title: How do I write to a label Excel object property using the Interop
body: <p>I'm converting some vb.net code which uses Excel to use the Excel interops (version 14) which MS provides. I've succesfully coverted lots of code, but I have one last problem, I can't set an Excel form label caption text.
  I'm using Shapes instead of Pictures and I tried to do the same with Shapes.AddLabel, but I can't make it.</p>
  
  <p>This is the old code I had working with the COM object</p>
  
  <pre><code>With ExcelObject
      .ActiveSheet.OLEObjects.Add(ClassType:="Forms.Label.1", Link:=False,
      DisplayAsIcon:=False, Left:=iTempLeft, Top:=iTempTop,
      Width:=iTempWidth, Height:=iTempHeight).Select() 
      iLabels = iLabels + 1
      sLabelName = "Label" &amp; CStr(iLabels)
      .ActiveSheet.OLEObjects(sLabelName).object.Caption = gudtDrawingAndDefectXYsForPrint(iDrawing).sDrawingName
      .ActiveSheet.OLEObjects(sLabelName).Placement = Microsoft.Office.Interop.Excel.XlPlacement.xlMoveAndSize 
  End With
  </code></pre>
  
  <p>And now this is the updated code I tried to make for using the Interop</p>
  
  <pre><code>With ExcelObject
       CType(.ActiveSheet, Excel.Worksheet).Shapes.AddLabel(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, iTempLeft, iTempTop, iTempWidth, iTempHeight).Name = sLabelName
       CType(.ActiveSheet, Excel.Worksheet).Shapes.Item(sLabelName).Placement = Excel.XlPlacement.xlMoveAndSize
       CType(.ActiveSheet, Excel.Worksheet).Shapes.Item(sLabelName).Title = gudtDrawingAndDefectXYsForPrint(iDrawing).sDrawingName
  End Width
  </code></pre>
  
  <p>The title won't display anything in screen as "Caption" did using COM object.</p>