![]() |
VB .NET Excel Builtin Property Access fails
I've already asked this question in the microsoft.public.dotnet.languages.vb
forum, but it has stumped them. I wondered if anyone had tried to access/set the workbook properties using VB .NET? When I try it, I get the following failure when trying to access the builtin properties; An unhandled exception of type 'System.InvalidCastException' occurred in resultsoutput.dll Additional information: Specified cast is not valid. In general terms the code is constructed as follows; ModuleA Public xlWb As Excel.Workbook ModuleB SubA Dim prps As Microsoft.Office.Core.DocumentProperties prps = DirectCast(xlWb.BuiltinDocumentProperties, Microsoft.Office.Core.DocumentProperties) This is using; Framework 1.1 Excel 2002 SP3 Reference to COM Microsoft Excel 10.0 Object Library (Version 1.4) I've been following the article by Ken Getz (http://msdn.microsoft.com/library/de...-us/odc_vsto20 03_ta/html/ExcelObj.asp) which suggests the code should work. Ken's article refers to Excel 2003, but all the objects he references are also in the Microsoft Excel 10 COM object. I wondered whether this was a bug in the 2002 COM or I've missed something in my code. |
All times are GMT +1. The time now is 03:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com