This is how I do it now, it seems that it works very well
using Excel = Microsoft.Office.Interop.Excel;
Then you get an active workbook
//Gets Excel and gets Activeworkbook and worksheet Excel.Application oXL; Excel.Workbook oWB; Excel.Worksheet oSheet; oXL = (Excel.Application)Marshal.GetActiveObject("Excel.Application"); oXL.Visible = true; oWB = (Excel.Workbook)oXL.ActiveWorkbook; docProps = oWB.CustomDocumentProperties
Then I will try what you have and see how it works.
Hope this helps
source share