Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with VFP and Excel 2000?...
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00308023
Message ID:
00308705
Views:
61
>Hiya Gonz (and troops),
>
>Well, I found the problem, and, IMHO, it's about as nasty and insidious a bug (and I mean bug) as you or I'll run into. I'd like to say it was simply a memory leak, but because the "problem" is corrected when you quit VFP, it really doesn't, IMO, qualify.
>
>First, of all what causes it. If you iterate through the cells in a range via somthing like FOR EACH oCell IN oRange, it pops up. Without this, it doesn't happen.
>
>Now, I've tried just about everything I can think of to correct this without success. I've explicitly set the properties holding the references to NULL in the object's Destroy event. Additionally, I've set any copies of the properties to NULL and issued an explicit RELEASE... to the variables that hold the references with no change.
>
>The reason that I've zeroed in on the FOR EACH loop is that remarking it out causes the problem to go away.
>
>Fixes? Well, QUITting is one. CLEAR ALL is another. Neither of these, however, is terribly desirable. I can work with CLEAR ALL by re-initializing the application object, but somehow, to me, that seems less than a satisfactory solution. Especially when one of the members of the object holds the user name and password to connect to SQL Server.
>
>What makes it especially nasty, as far as I'm concerned, is that repeated calls create additional copies of Excel. While they're cleared with either of the above methods, they do present a significant amount of additional overhead. When the posibility exists of there being 10 or so references like this for my application, it is significant.
>
>I would appreciate it if someone can verify that this also occurs under NT. All that has to be done (as far as I know) is get a reference to a range and iterate through the cells in the range using the technique described above. I'll post the actual code that does this tomorrow afternoon. This doesn't seem like it would be a Windows problem, however. I'll really be surprised if it doesn't happen under NT as well.

Similar to the problem of using a TreeView object and trying to use the built-in object references to other nodes. If you stored a reference in a VFP variable, the form would have a "dangling object" reference, but if you just referenced the treeview node object directly, it didn't. Didn't matter if you RELEASED the VFP variable,, NULLed it, made it LOCAL, it still hung around.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform