|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
How do I close an Excel Workbook instance to prevent sharing violation?
Here's an excerpt of my code:
Dim xlApp As Excel.Application ' new instantiation of Excel Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet '-- Open Excel and Select CheckBook Worksheet xlApp.Workbooks.Open excelFile xlApp.ActiveWorkbook.Worksheets (txtActiveWorkSheet.Text).Select '-- Code in here to Update Excel Workbook xlApp.ActiveWorkbook.Save xlApp.ActiveWorkbook.Close xlApp.Workbooks.Close Set xlSheet = Nothing Set xlBook = Nothing Set xlApp = Nothing |
|
#2
|
|||
|
|||
|
Have you tried
xlBook.close or '*** Close and save the workbook *** xlBook.Close(vbYes) |
|
#3
|
|||
|
|||
|
I thought I had tried that, but I'm not sure anymore. I will give it a try. Thank you krinpit
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > How do I close an Excel Workbook instance to prevent sharing violation? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|