Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27184

MS Excel 2010 with VB.net...close opened excel file...

$
0
0
Hi. I have two scenarios I need to do but don't know how.
1- Check to see if that excel file is already opened. If so then close it before writing to it else VB.NET will complain that the file is already opened.
2- have VB.NET just write over it while it is still open.

At the end of my VB.NET project I had already closed everything with:
Code:

        xlWorkBook.Close()
        xlApp.Quit()
        xlWorkBook = Nothing
        xlApp = Nothing

That is not the issue. The issue is I would open the Excel file to check for correctness of data collection, but did not close it.
I would then run the VB application again. This is when VB.NET complain about the file still being open.

Please advise. If code is available, please include. Thank you.

Viewing all articles
Browse latest Browse all 27184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>