Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET Office Automation (http://www.xtremevbtalk.com/-net-office-automation/)
-   -   Disposing Excel Object (http://www.xtremevbtalk.com/-net-office-automation/327137-disposing-excel-object.html)

jojo69 07-02-2014 02:13 PM

Disposing Excel Object
 
Is this the correct way to release resources using Excel Object Model and VB.net

Code:

        oExcel.DisplayAlerts = False
        osheet = Nothing
        oBook.Close(True)
        oExcel.DisplayAlerts = True
       

        oExcel.Quit()


Cerian Knight 07-02-2014 03:49 PM

On the surface that seems basically correct... but there is more to the subject than meets the eye. I suggest having a look at this, if you haven't done so:
http://www.xtremevbtalk.com/tutors-corner/160433-automating-office-programs-vb-net-com-interop.html


All times are GMT -6. The time now is 10:22 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.