Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

CustomDocuments Properties in Excel

Mar 2 2003 4:55 PM
I don't have any compile errors, but at run time I get and Invalid Cast Type. I have tried boxing the type, but that does not work. Here is what my Code Looks like: Microsoft.Office.Core.DocumentProperties cdp; Microsoft.Office.Introp.Excel.Application app; Microsoft.Office.Introp.Excel.Workbook wb; app = new Microsoft.Office.Introp.Excel.Application(); wb = app.workbooks.open(Filename, Missing.Value ....); cdp = (Microsoft.Office.Core.DocumentProperties)wb.CustomDocumentProperties; // Error Happens Here foreach(Microsoft.Office.Introp.Core.DocumentProperty dp in cdp) { .... }