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:
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.
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 = NothingI 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.