![]() |
VB.NET and Excel Range data
I have a program written in VB6 that opens an Excel App;ication, selects a worksheet and reads the data from 6 Cols x 15 Rows. This data is placed into an array formated to type double and then VB6 performs some math calculations. No problem. I tried to convert this small program to VB.NET and the best I can get is an error message to the effect that the type Range cannot be converted to a type double. I have upgraded my Office XP with the necessary Interop according to Microsoft and have added the necessary references to my main program. I did have all of my Excel calling and reading routines in a module but now I'm trying to get away from a module situation. My 'not working code' can be provided if someone is willing to look at it
Thanks for anyones help Pet |
VB.NET and Excel Range data
Are you explicitly using the range's Value (or equivalent) property
i.e. something like CDbl(Range("A1").Value) rather than the sloppy CDbl(Range("A1")) This is a heads up for everyone out there who implicitly use the Range object's default method. Always *explicitly* use the Value method, otherwise it may trip you up one day! -- "Pete" wrote in message ... I have a program written in VB6 that opens an Excel App;ication, selects a worksheet and reads the data from 6 Cols x 15 Rows. This data is placed into an array formated to type double and then VB6 performs some math calculations. No problem. I tried to convert this small program to VB.NET and the best I can get is an error message to the effect that the type Range cannot be converted to a type double. I have upgraded my Office XP with the necessary Interop according to Microsoft and have added the necessary references to my main program. I did have all of my Excel calling and reading routines in a module but now I'm trying to get away from a module situation. My 'not working code' can be provided if someone is willing to look at it. Thanks for anyones help. Pete |
All times are GMT +1. The time now is 05:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com